mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
gdbus-codegen: Fix leak in property setter
Comparing the code generated for the setter and other methods without (real) return value, I noticed that the setter does not unref the gvariant it gets. https://bugzilla.gnome.org/show_bug.cgi?id=719472
This commit is contained in:
@@ -1629,14 +1629,20 @@ class CodeGenerator:
|
|||||||
'{\n'%(i.name_lower))
|
'{\n'%(i.name_lower))
|
||||||
self.c.write(' const _ExtendedGDBusPropertyInfo *info = user_data;\n'
|
self.c.write(' const _ExtendedGDBusPropertyInfo *info = user_data;\n'
|
||||||
' GError *error;\n'
|
' GError *error;\n'
|
||||||
|
' GVariant *_ret;\n'
|
||||||
' error = NULL;\n'
|
' error = NULL;\n'
|
||||||
' if (!g_dbus_proxy_call_finish (proxy, res, &error))\n'
|
' _ret = g_dbus_proxy_call_finish (proxy, res, &error);\n'
|
||||||
|
' if (!_ret)\n'
|
||||||
' {\n'
|
' {\n'
|
||||||
' g_warning ("Error setting property \'%%s\' on interface %s: %%s (%%s, %%d)",\n'
|
' g_warning ("Error setting property \'%%s\' on interface %s: %%s (%%s, %%d)",\n'
|
||||||
' info->parent_struct.name, \n'
|
' info->parent_struct.name, \n'
|
||||||
' error->message, g_quark_to_string (error->domain), error->code);\n'
|
' error->message, g_quark_to_string (error->domain), error->code);\n'
|
||||||
' g_error_free (error);\n'
|
' g_error_free (error);\n'
|
||||||
' }\n'
|
' }\n'
|
||||||
|
' else\n'
|
||||||
|
' {\n'
|
||||||
|
' g_variant_unref (_ret);\n'
|
||||||
|
' }\n'
|
||||||
%(i.name))
|
%(i.name))
|
||||||
self.c.write('}\n'
|
self.c.write('}\n'
|
||||||
'\n')
|
'\n')
|
||||||
|
Reference in New Issue
Block a user