From b3cc28bc34bd0b341f1786dc478cff259ce5d1da Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 17 Jun 2010 18:26:15 +0200 Subject: [PATCH] =?utf8?q?Bug=20621905=20=E2=80=93=20Assume=20a=20ref=20wh?= =?utf8?q?en=20doing=20async=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When asynchronously acquiring the DBus connection, assume a reference to the proxy object, to avoid destroying it in the middle of the operation. See https://bugzilla.gnome.org/show_bug.cgi?id=621905 --- gio/gdbusproxy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index eaae1dc..78e4fa4 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -1418,6 +1418,8 @@ get_connection_cb (GObject *source_object, if (data->cancellable != NULL) g_object_unref (data->cancellable); + if (data->proxy != NULL) + g_object_unref (data->proxy); g_free (data); } @@ -1437,7 +1439,7 @@ async_initable_init_async (GAsyncInitable *initable, g_assert (proxy->priv->connection == NULL); data = g_new0 (GetConnectionData, 1); - data->proxy = proxy; + data->proxy = g_object_ref (proxy); data->io_priority = io_priority; data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL; data->callback = callback; -- 2.7.4