[gjs] Object: don't access priv->info if it's NULL
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] Object: don't access priv->info if it's NULL
- Date: Mon, 27 Aug 2012 18:28:23 +0000 (UTC)
commit 123b631e40b8e60475e41d32263a3e99207dcfde
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Aug 27 19:52:16 2012 +0200
Object: don't access priv->info if it's NULL
priv->info can be NULL if the object is known by it's interfaces only
(like GDrive or GFile), or if the type is derived in JS, but object_instance_init
accessed it anyway for the dtrace probe.
A similar change is made to object_instance_finalize, to keep consistency.
gi/object.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gi/object.c b/gi/object.c
index 1b02fae..c2cd0c5 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -996,8 +996,9 @@ object_instance_init (JSContext *context,
"JSObject created with GObject %p %s",
priv->gobj, g_type_name_from_instance((GTypeInstance*) priv->gobj));
- TRACE(GJS_OBJECT_PROXY_NEW(priv, priv->gobj, g_base_info_get_namespace ( (GIBaseInfo*) priv->info),
- g_base_info_get_name ( (GIBaseInfo*) priv->info) ));
+ TRACE(GJS_OBJECT_PROXY_NEW(priv, priv->gobj,
+ priv->info ? g_base_info_get_namespace((GIBaseInfo*) priv->info) : "_gjs_private",
+ priv->info ? g_base_info_get_name((GIBaseInfo*) priv->info) : g_type_name(gtype)));
out:
return JS_TRUE;
@@ -1075,8 +1076,8 @@ object_instance_finalize(JSContext *context,
return; /* we are the prototype, not a real instance, so constructor never called */
TRACE(GJS_OBJECT_PROXY_FINALIZE(priv, priv->gobj,
- priv->info ? g_base_info_get_namespace ( (GIBaseInfo*) priv->info) : "",
- priv->info ? g_base_info_get_name ( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype)));
+ priv->info ? g_base_info_get_namespace((GIBaseInfo*) priv->info) : "_gjs_private",
+ priv->info ? g_base_info_get_name((GIBaseInfo*) priv->info) : g_type_name(priv->gtype)));
if (priv->gobj) {
invalidate_all_signals (priv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]