[Galago-commits] r2646 - in trunk/libgalago: . libgalago
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Fri Mar 31 11:57:50 PST 2006
Author: chipx86
Date: 2006-03-31 11:57:48 -0800 (Fri, 31 Mar 2006)
New Revision: 2646
Modified:
trunk/libgalago/ChangeLog
trunk/libgalago/libgalago/galago-core.c
Log:
Patch by Jorn Baayen to improve re-registration when galago-daemon dies. This properly unregisters when galago-daemon dies and then re-registers when it comes back up, without leaking any memory. This fixes bug #34.
Modified: trunk/libgalago/ChangeLog
===================================================================
--- trunk/libgalago/ChangeLog 2006-03-31 19:51:49 UTC (rev 2645)
+++ trunk/libgalago/ChangeLog 2006-03-31 19:57:48 UTC (rev 2646)
@@ -1,3 +1,11 @@
+Fri Mar 31 11:56:33 PST 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libgalago/galago-core.c:
+ - Patch by Jorn Baayen to improve re-registration when galago-daemon
+ dies. This properly unregisters when galago-daemon dies and then
+ re-registers when it comes back up, without leaking any memory. This
+ fixes bug #34.
+
Fri Mar 31 11:51:03 PST 2006 Christian Hammond <chipx86 at chipx86.com>
* libgalago/galago-core.c:
Modified: trunk/libgalago/libgalago/galago-core.c
===================================================================
--- trunk/libgalago/libgalago/galago-core.c 2006-03-31 19:51:49 UTC (rev 2645)
+++ trunk/libgalago/libgalago/galago-core.c 2006-03-31 19:57:48 UTC (rev 2646)
@@ -97,6 +97,7 @@
static void _galago_core_disconnect(void);
static gboolean _galago_dbus_register_connection(void);
static void _galago_dbus_unregister_connection(void);
+static void _galago_dbus_unregister_connection_finish(void);
static void _galago_dbus_core_add_service(GalagoService *service);
static void _galago_dbus_core_remove_service(GalagoService *service);
static void _galago_dbus_core_add_person(GalagoPerson *person);
@@ -256,12 +257,6 @@
if (_core->app_name != NULL)
g_free(_core->app_name);
- if (_core->uid != NULL)
- g_free(_core->uid);
-
- if (_core->conn_obj_path != NULL)
- g_free(_core->conn_obj_path);
-
G_LOCK(_core_lock);
_core = NULL;
G_UNLOCK(_core_lock);
@@ -319,16 +314,9 @@
if (!galago_is_daemon())
{
- galago_context_clear_objects(FALSE);
-
- galago_set_watch_all(FALSE);
-
- _core->daemon_active = FALSE;
- _core->registered = FALSE;
-
- g_signal_emit(_core, signals[UNREGISTERED], 0);
+ _galago_dbus_unregister_connection_finish();
}
-
+
dbus_error_init(&error);
if (!dbus_bus_start_service_by_name(_core->dbus_conn,
@@ -385,13 +373,18 @@
gboolean old_owner_good = (old_owner && *old_owner != '\0');
gboolean new_owner_good = (new_owner && *new_owner != '\0');
- if (!old_owner_good && new_owner_good)
+ if (old_owner_good)
{
if (galago_get_exit_with_daemon())
exit(0);
else
- reregister_client();
+ _galago_dbus_unregister_connection_finish();
}
+
+ if (new_owner_good)
+ {
+ reregister_client();
+ }
}
}
else
@@ -1258,8 +1251,6 @@
{
g_warning("Unable to register local Galago connection.");
- _core->daemon_active = FALSE;
-
return FALSE;
}
@@ -1293,8 +1284,30 @@
dbus_connection_flush(_core->dbus_conn); /* Keep this here! */
+ _galago_dbus_unregister_connection_finish();
+}
+
+static void
+_galago_dbus_unregister_connection_finish(void)
+{
+ galago_context_clear_objects(GALAGO_REMOTE);
+
+ galago_set_watch_all(FALSE);
+
+ _core->daemon_active = FALSE;
_core->registered = FALSE;
+ if (_core->uid)
+ {
+ g_free (_core->uid);
+ _core->uid = NULL;
+ }
+ if (_core->conn_obj_path)
+ {
+ g_free (_core->conn_obj_path);
+ _core->conn_obj_path = NULL;
+ }
+
g_signal_emit(_core, signals[UNREGISTERED], 0);
}
More information about the galago-commits
mailing list