summary refs log tree commit diff
path: root/libnm-glib/nm-remote-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-glib/nm-remote-connection.c')
-rw-r--r--libnm-glib/nm-remote-connection.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 3a70e81e..4298129b 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -22,17 +22,15 @@
 #include "config.h"
 
 #include <string.h>
-#include <gio/gio.h>
-#include <glib/gi18n-lib.h>
 
 #include <NetworkManager.h>
 #include <nm-utils.h>
 #include <nm-setting-connection.h>
+#include "nm-default.h"
 #include "nm-remote-connection.h"
 #include "nm-remote-connection-private.h"
 #include "nm-object-private.h"
 #include "nm-dbus-glib-types.h"
-#include "nm-glib-compat.h"
 #include "nm-dbus-helpers-private.h"
 
 #define NM_REMOTE_CONNECTION_BUS "bus"
@@ -498,6 +496,9 @@ updated_get_settings_cb (DBusGProxy *proxy,
 		priv->visible = FALSE;
 		g_signal_emit (self, signals[VISIBLE], 0, FALSE);
 	} else {
+		gs_unref_object NMConnection *self_alive = NULL;
+
+		self_alive = g_object_ref (self);
 		replace_settings (self, new_settings);
 		g_hash_table_destroy (new_settings);
 
@@ -620,6 +621,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
 {
 	NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
 	GHashTable *hash;
+	gs_unref_object NMConnection *self_alive = NULL;
 
 	if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
 	                        G_TYPE_INVALID,
@@ -627,6 +629,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
 	                        G_TYPE_INVALID))
 		return FALSE;
 	priv->visible = TRUE;
+	self_alive = g_object_ref (initable);
 	replace_settings (NM_REMOTE_CONNECTION (initable), hash);
 	g_hash_table_destroy (hash);
 
@@ -690,6 +693,7 @@ init_get_settings_cb (DBusGProxy *proxy,
 	NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
 	GHashTable *settings;
 	GError *error = NULL;
+	gs_unref_object NMConnection *self_alive = NULL;
 
 	dbus_g_proxy_end_call (proxy, call, &error,
 	                       DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
@@ -700,6 +704,7 @@ init_get_settings_cb (DBusGProxy *proxy,
 	}
 
 	priv->visible = TRUE;
+	self_alive = g_object_ref (init_data->connection);
 	replace_settings (init_data->connection, settings);
 	g_hash_table_destroy (settings);