From 7fae05b11eea1644bf0a0a7e773c7753a9b620d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 8 Dec 2010 10:11:30 -0600 Subject: Making sure we have more ref's on our callbacks. --- src/app-indicator.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index 744590b..2b45b85 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -887,6 +887,7 @@ bus_creation (GObject * obj, GAsyncResult * res, gpointer user_data) if (error != NULL) { g_warning("Unable to get the session bus: %s", error->message); g_error_free(error); + g_object_unref(G_OBJECT(user_data)); return; } @@ -1091,6 +1092,8 @@ bus_watcher_ready (GObject * obj, GAsyncResult * res, gpointer user_data) if (IS_APP_INDICATOR(user_data)) { start_fallback_timer(APP_INDICATOR(user_data), FALSE); } + + g_object_unref(G_OBJECT(user_data)); return; } @@ -1109,9 +1112,15 @@ bus_watcher_ready (GObject * obj, GAsyncResult * res, gpointer user_data) gchar * name = g_dbus_proxy_get_name_owner(app->priv->watcher_proxy); if (name == NULL) { start_fallback_timer(APP_INDICATOR(user_data), FALSE); + g_object_unref(G_OBJECT(user_data)); return; } + /* g_object_unref(G_OBJECT(user_data)); */ + /* Why is this commented out? Oh, wait, we don't want to + unref in this case because we need to ref again to do the + register callback. Let's not unref to ref again. */ + g_dbus_proxy_call(app->priv->watcher_proxy, "RegisterStatusNotifierItem", g_variant_new("(s)", app->priv->path), @@ -1121,8 +1130,6 @@ bus_watcher_ready (GObject * obj, GAsyncResult * res, gpointer user_data) register_service_cb, user_data); - g_object_unref(G_OBJECT(user_data)); - return; } @@ -1173,6 +1180,7 @@ register_service_cb (GObject * obj, GAsyncResult * res, gpointer user_data) be doing */ g_warning("Unable to connect to the Notification Watcher: %s", error->message); start_fallback_timer(APP_INDICATOR(user_data), TRUE); + g_object_unref(G_OBJECT(user_data)); return; } @@ -1191,6 +1199,7 @@ register_service_cb (GObject * obj, GAsyncResult * res, gpointer user_data) } } + g_object_unref(G_OBJECT(user_data)); return; } -- cgit v1.2.3