[gnome-software/gnome-3-14] update monitor: Disconnect signals in finalize



commit 286b59faf1a3bf26c1524c8a8548dcc24af0d1f1
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Jun 7 00:11:46 2015 +0200

    update monitor: Disconnect signals in finalize
    
    ... so that we don't get callbacks after being finalized and crash.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1222755

 src/gs-update-monitor.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 6693b79..ee0b082 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -578,12 +578,18 @@ gs_update_monitor_finalize (GObject *object)
                g_source_remove (monitor->reenable_offline_update_id);
                monitor->reenable_offline_update_id = 0;
        }
+       if (monitor->control != NULL) {
+               g_signal_handlers_disconnect_by_func (monitor->control, notify_network_state_cb, monitor);
+               g_clear_object (&monitor->control);
+       }
+       if (monitor->offline_update_monitor != NULL) {
+               g_signal_handlers_disconnect_by_func (monitor->offline_update_monitor, 
offline_update_monitor_cb, monitor);
+               g_clear_object (&monitor->offline_update_monitor);
+       }
        g_clear_pointer (&monitor->pending_downloads, g_strfreev);
        g_clear_pointer (&monitor->check_timestamp, g_date_time_unref);
        g_clear_object (&monitor->task);
-       g_clear_object (&monitor->control);
        g_clear_object (&monitor->offline_update_file);
-       g_clear_object (&monitor->offline_update_monitor);
        g_clear_object (&monitor->settings);
        g_application_release (monitor->application);
 


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