summary refs log tree commit diff
path: root/src/settings/nm-settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/nm-settings.c')
-rw-r--r--src/settings/nm-settings.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index fd1d316a..8e18a33e 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -36,7 +36,7 @@
 #include <selinux/selinux.h>
 #endif
 
-#include "nm-common-macros.h"
+#include "nm-libnm-core-intern/nm-common-macros.h"
 #include "nm-dbus-interface.h"
 #include "nm-connection.h"
 #include "nm-setting-8021x.h"
@@ -60,7 +60,7 @@
 #include "nm-utils.h"
 #include "nm-core-internal.h"
 
-#include "nm-utils/nm-c-list.h"
+#include "nm-glib-aux/nm-c-list.h"
 #include "nm-dbus-object.h"
 #include "devices/nm-device-ethernet.h"
 #include "nm-settings-connection.h"
@@ -1138,7 +1138,7 @@ pk_add_cb (NMAuthChain *chain,
 	NMAuthCallResult result;
 	GError *error = NULL;
 	NMConnection *connection = NULL;
-	NMSettingsConnection *added = NULL;
+	gs_unref_object NMSettingsConnection *added = NULL;
 	NMSettingsAddCallback callback;
 	gpointer callback_data;
 	NMAuthSubject *subject;
@@ -1169,6 +1169,12 @@ pk_add_cb (NMAuthChain *chain,
 
 		save_to_disk = GPOINTER_TO_UINT (nm_auth_chain_get_data (chain, "save-to-disk"));
 		added = nm_settings_add_connection (self, connection, save_to_disk, &error);
+
+		/* The callback may remove the connection from the settings manager (e.g.
+		 * because it's found to be incompatible with the device on AddAndActivate).
+		 * But we need to keep it alive for a bit longer, precisely to check wehther
+		 * it's still known to the setting manager. */
+		g_object_ref (added);
 	}
 
 	callback = nm_auth_chain_get_data (chain, "callback");