[gjs] js: Check for NULL in tracers
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] js: Check for NULL in tracers
- Date: Fri, 11 Nov 2016 02:58:31 +0000 (UTC)
commit bb93b97f44c46e2241ae0de927749b95bd2ee968
Author: Philip Chimento <philip endlessm com>
Date: Thu Nov 10 17:24:27 2016 -0800
js: Check for NULL in tracers
It's possible to have a GC before the private data of these objects is
allocated. In that case, there's nothing to trace, so if the private data
member is NULL then just return from the trace callback.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gi/boxed.cpp | 2 ++
gi/fundamental.cpp | 2 ++
gi/object.cpp | 2 ++
3 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 60b3337..4a2dd2e 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -888,6 +888,8 @@ boxed_trace(JSTracer *tracer,
JSObject *obj)
{
Boxed *priv = reinterpret_cast<Boxed *>(JS_GetPrivate(obj));
+ if (priv == NULL)
+ return;
JS_CallHeapIdTracer(tracer, &priv->zero_args_constructor_name,
"Boxed::zero_args_constructor_name");
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 86876f3..bd5a6d6 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -524,6 +524,8 @@ fundamental_trace(JSTracer *tracer,
JSObject *obj)
{
Fundamental *priv = reinterpret_cast<Fundamental *>(JS_GetPrivate(obj));
+ if (priv == NULL)
+ return;
JS_CallHeapIdTracer(tracer, &priv->constructor_name,
"Fundamental::constructor_name");
diff --git a/gi/object.cpp b/gi/object.cpp
index c854c71..824d2d8 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1366,6 +1366,8 @@ object_instance_trace(JSTracer *tracer,
GList *iter;
priv = (ObjectInstance *) JS_GetPrivate(obj);
+ if (priv == NULL)
+ return;
for (iter = priv->signals; iter; iter = iter->next) {
ConnectData *cd = (ConnectData *) iter->data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]