gdbus-codegen: Fix crasher in goa-using apps

When replacing a version of goa-daemon (from gnome-online-accounts)
by a newer version with some added interfaces, evolution-data-server
and the gvfs-goa volume monitor might crash as there's no interface
definition for this new interface.

Work-around this by returning earlier from the _notify() implementation,
rather than accessing invalid memory.

https://bugzilla.gnome.org/show_bug.cgi?id=720539
This commit is contained in:
Bastien Nocera 2013-12-16 17:21:41 +01:00
parent d33f72097f
commit c300079f13

View File

@ -2768,7 +2768,12 @@ class CodeGenerator:
self.c.write('static void\n'
'%sobject_notify (GDBusObject *object, GDBusInterface *interface)\n'
'{\n'
' g_object_notify (G_OBJECT (object), ((_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface))->hyphen_name);\n'
' _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);\n'
' /* info can be NULL if the other end is using a D-Bus interface we don\'t know\n'
' * anything about, for example old generated code in this process talking to\n'
' * newer generated code in the other process. */\n'
' if (info != NULL)\n'
' g_object_notify (G_OBJECT (object), info->hyphen_name);\n'
'}\n'
'\n'
%(self.ns_lower))