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



commit e62f3b49cbed02058d6e8eed7a94bd1eddb2a0b3
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 f318375..1bf2eaf 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -554,12 +554,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]