[gnome-control-center/rhel/8.4.0: 16/32] network: Keep a ref on NetDeviceEthernet while a edition dialog is open




commit f526c4974671d4206f78f4473e3062ba520e8264
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 28 16:38:03 2019 +0100

    network: Keep a ref on NetDeviceEthernet while a edition dialog is open
    
    Otherwise, invoking other panel (eg. through shell search, or CLI) and
    closing the dialog will result in a crash, as the NetDeviceEthernet
    object does no longer exist.

 panels/network/net-device-ethernet.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index a03fa8de3..b035ce81c 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -233,6 +233,7 @@ editor_done (NetConnectionEditor *editor,
 {
         g_object_unref (editor);
         device_ethernet_refresh_ui (device);
+        g_object_unref (device);
 }
 
 static void
@@ -255,7 +256,7 @@ show_details (GtkButton *button, NetDeviceEthernet *device, const gchar *title)
         editor = net_connection_editor_new (GTK_WINDOW (window), connection, nmdev, NULL, client);
         if (title)
                 net_connection_editor_set_title (editor, title);
-        g_signal_connect (editor, "done", G_CALLBACK (editor_done), device);
+        g_signal_connect (editor, "done", G_CALLBACK (editor_done), g_object_ref (device));
         net_connection_editor_run (editor);
 }
 
@@ -455,7 +456,7 @@ add_profile (GtkButton *button, NetDeviceEthernet *device)
 
         nmdev = net_device_get_nm_device (NET_DEVICE (device));
         editor = net_connection_editor_new (GTK_WINDOW (window), connection, nmdev, NULL, client);
-        g_signal_connect (editor, "done", G_CALLBACK (editor_done), device);
+        g_signal_connect (editor, "done", G_CALLBACK (editor_done), g_object_ref (device));
         net_connection_editor_run (editor);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]