Blob Blame History Raw
From 0c581081fa18aa412885a700b6d5fc017a53a463 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Mon, 8 Oct 2018 21:43:18 +0200
Subject: [PATCH 2/2] cli: fix cleanup after activation from editor

progress_activation_editor_cb() is called multiple times every 120
milliseconds and it must free resources only the last time.

Fixes: f0a26865458a42dd35975efd9bf6fdd2d9445c08

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/51
(cherry picked from commit d091cbdc2fb2c953da226b92c461ae3ede2cece0)
(cherry picked from commit fd3658e25f5c18d9d53d3f580cfce68ed416848b)
(cherry picked from commit 09d8eca1c26fe96731182df096804e8421dbdd7c)
---
 clients/cli/connections.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index b547e34ca..f6066b87d 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -6523,8 +6523,8 @@ static gboolean
 progress_activation_editor_cb (gpointer user_data)
 {
 	MonitorACInfo *info = (MonitorACInfo *) user_data;
-	gs_unref_object NMDevice *device = info->device;
-	gs_unref_object NMActiveConnection *ac = info->ac;
+	NMDevice *device = info->device;
+	NMActiveConnection *ac = info->ac;
 	NMActiveConnectionState ac_state;
 	NMDeviceState dev_state;
 
@@ -6557,11 +6557,13 @@ progress_activation_editor_cb (gpointer user_data)
 		                               nm_object_get_path (NM_OBJECT (connection)));
 	}
 
-	return TRUE;
+	return G_SOURCE_CONTINUE;
 
 finish:
+	nm_g_object_unref (device);
+	nm_g_object_unref (ac);
 	info->monitor_id = 0;
-	return FALSE;
+	return G_SOURCE_REMOVE;
 }
 
 static void
-- 
2.20.1