libnm-glib: crash when NMRemoteSettings is quickly destroyed (bgo #742138)

NMRemoteSettings queues a bunch of async NMRemoteConnection creations,
but wasn't doing anything to ensure that it was still alive when they
completed. Pointed out by Cosimo Cecchi.

https://bugzilla.gnome.org/show_bug.cgi?id=742138
This commit is contained in:
Dan Winship 2015-01-05 15:35:57 -05:00
parent f6cd8f06f4
commit 3d47cf5823

View file

@ -511,6 +511,8 @@ connection_inited (GObject *source, GAsyncResult *result, gpointer user_data)
priv->init_left--;
if (priv->init_left == 0)
g_signal_emit (self, signals[CONNECTIONS_READ], 0);
g_object_unref (self);
}
static NMRemoteConnection *
@ -533,7 +535,7 @@ new_connection_cb (DBusGProxy *proxy, const char *path, gpointer user_data)
if (connection) {
g_async_initable_init_async (G_ASYNC_INITABLE (connection),
G_PRIORITY_DEFAULT, NULL,
connection_inited, self);
connection_inited, g_object_ref (self));
/* Add the connection to the pending table to wait for it to retrieve
* it's settings asynchronously over D-Bus. The connection isn't