summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2011-02-15 11:09:59 -0500
committerDavid Zeuthen <davidz@redhat.com>2011-02-15 11:09:59 -0500
commit58b0d3aeb4c48b889e616c68dbd27167f9cf11f8 (patch)
tree180a54cae323ceebf92f833c80d3c93ac2827989
parent95dae0a01714e5cbe6a1ef9ab4e37ac28d12971a (diff)
Don't call g_variant_unref() with a NULL GVariant
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r--src/codegen.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/codegen.py b/src/codegen.py
index 647421e..d01b4ad 100644
--- a/src/codegen.py
+++ b/src/codegen.py
@@ -843,7 +843,11 @@ class CodeGenerator:
' %svalue;\n'%(p.arg.ctype_in, i.name_lower, p.name_lower, i.camel_name, p.arg.ctype_in_g))
self.c.write(' g_object_get (G_OBJECT (object), "%s", &value, NULL);\n'%(p.name_hyphen))
if p.arg.free_func:
- self.c.write(' g_object_set_data_full (G_OBJECT (object), "-x-memoizing-%s", (gpointer) value, (GDestroyNotify) %s);\n'%(p.name_hyphen, p.arg.free_func))
+ self.c.write(' if (value != NULL)\n'
+ ' g_object_set_data_full (G_OBJECT (object), "-x-memoizing-%s", (gpointer) value, (GDestroyNotify) %s);\n'
+ ' else\n'
+ ' g_object_set_data_full (G_OBJECT (object), "-x-memoizing-%s", (gpointer) value, NULL);\n'
+ %(p.name_hyphen, p.arg.free_func, p.name_hyphen))
self.c.write(' return value;\n')
self.c.write('}\n')
self.c.write('\n')