[glib] gdbus-codegen: Fix crasher in goa-using apps



commit c300079f1320b8522a4885987fd2443c171ec629
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 16 17:21:41 2013 +0100

    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

 gio/gdbus-2.0/codegen/codegen.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index e72cb31..c711d44 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]