GtkPlacesSidebar: Hold a reference to the sidebar while a D-Bus proxy is being created

The creation is async, and the sidebar could be destroyed while the D-Bus proxy is being created.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
Federico Mena Quintero 2013-04-11 20:04:53 -05:00
parent 5b827c53e5
commit d3985dec1d

View File

@ -3301,6 +3301,8 @@ hostname_proxy_new_cb (GObject *source_object,
sidebar->hostnamed_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
g_clear_object (&sidebar->hostnamed_cancellable);
g_object_unref (sidebar);
if (error != NULL) {
g_debug ("Failed to create D-Bus proxy: %s", error->message);
g_error_free (error);
@ -3588,7 +3590,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
"org.freedesktop.hostname1",
sidebar->hostnamed_cancellable,
hostname_proxy_new_cb,
sidebar);
g_object_ref (sidebar));
}
static void