From fb2c49cfc95ee82f77df6b8242199599f5e9f9ee Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jul 2007 11:22:06 +0000 Subject: Invalidate parent data before unregistering the child path since the unregister function might free the child path string (if it is part of the object path data) --- common/dbus-helper.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/common/dbus-helper.c b/common/dbus-helper.c index 488b1d2f..a604f6de 100644 --- a/common/dbus-helper.c +++ b/common/dbus-helper.c @@ -283,7 +283,7 @@ static DBusObjectPathVTable generic_table = { .message_function = generic_message, }; -static void update_parent_data(DBusConnection *conn, const char *child_path) +static void invalidate_parent_data(DBusConnection *conn, const char *child_path) { struct generic_data *data = NULL; char *parent_path, *slash; @@ -330,7 +330,7 @@ dbus_bool_t dbus_connection_create_object_path(DBusConnection *connection, return FALSE; } - update_parent_data(connection, path); + invalidate_parent_data(connection, path); return TRUE; } @@ -338,12 +338,9 @@ dbus_bool_t dbus_connection_create_object_path(DBusConnection *connection, dbus_bool_t dbus_connection_destroy_object_path(DBusConnection *connection, const char *path) { - if (!dbus_connection_unregister_object_path(connection, path)) - return FALSE; - - update_parent_data(connection, path); + invalidate_parent_data(connection, path); - return TRUE; + return dbus_connection_unregister_object_path(connection, path); } dbus_bool_t dbus_connection_get_object_user_data(DBusConnection *connection, -- cgit