diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-05-03 16:04:30 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-05-17 14:52:56 +0100 |
commit | 43f9dda46e9279b4489b6bd1efa0e5f9eb825a48 (patch) | |
tree | a3f32c517523ac69d30bd94bea4ea6988c139227 /dbus/dbus-gobject.c | |
parent | 4da28a6c49cecb902544d9152a693105d320cdac (diff) |
dbus_g_connection_register_g_object: don't destroy state on early return
At the beginning of the function we steal the object's state so we can add
to the list. After doing that, we must make sure we give it back!
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36793
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Diffstat (limited to 'dbus/dbus-gobject.c')
-rw-r--r-- | dbus/dbus-gobject.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index f130bb6..fc8f7ed 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -2550,7 +2550,9 @@ dbus_g_connection_register_g_object (DBusGConnection *connection, g_return_if_fail (g_variant_is_object_path (at_path)); g_return_if_fail (G_IS_OBJECT (object)); - /* This is a GSList of ObjectRegistration* */ + /* This is a GSList of ObjectRegistration*. + * After this point you must "goto put_back" to give this back to + * the object. */ registrations = g_object_steal_data (object, "dbus_glib_object_registrations"); for (iter = registrations; iter; iter = iter->next) @@ -2559,7 +2561,7 @@ dbus_g_connection_register_g_object (DBusGConnection *connection, /* Silently ignore duplicate registrations */ if (strcmp (o->object_path, at_path) == 0 && o->connection == connection) - return; + goto put_back; } is_first_registration = registrations == NULL; @@ -2575,7 +2577,7 @@ dbus_g_connection_register_g_object (DBusGConnection *connection, { g_warning ("No introspection data registered for object class \"%s\"", g_type_name (G_TYPE_FROM_INSTANCE (object))); - return; + goto put_back; } } else @@ -2591,7 +2593,7 @@ dbus_g_connection_register_g_object (DBusGConnection *connection, g_error ("Failed to register GObject with DBusConnection"); object_registration_free (o); g_list_free (info_list); - return; + goto put_back; } if (is_first_registration) @@ -2605,6 +2607,8 @@ dbus_g_connection_register_g_object (DBusGConnection *connection, } registrations = g_slist_append (registrations, o); + +put_back: g_object_set_data (object, "dbus_glib_object_registrations", registrations); } |