[gnome-photos] tracker-search-controller: Fix the lifetime of the signal handlers



commit d94dbb25dfeb1ca01b637b80a2ce7d8bc6be6e8a
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Feb 2 02:44:35 2018 +0100

    tracker-search-controller: Fix the lifetime of the signal handlers
    
    It's hard to prove the relative lifetimes of all the global singletons.
    The safest thing to do is to disconnect the signal handlers when the
    recipient gets destroyed.

 src/photos-tracker-search-controller.c | 36 +++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/src/photos-tracker-search-controller.c b/src/photos-tracker-search-controller.c
index a0ab7a2d..0ee9a6fe 100644
--- a/src/photos-tracker-search-controller.c
+++ b/src/photos-tracker-search-controller.c
@@ -136,30 +136,34 @@ photos_tracker_search_controller_init (PhotosTrackerSearchController *self)
   state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
 
   self->src_mngr = g_object_ref (state->src_mngr);
-  g_signal_connect_swapped (self->src_mngr,
-                            "active-changed",
-                            G_CALLBACK (photos_tracker_controller_refresh_for_object),
-                            self);
+  g_signal_connect_object (self->src_mngr,
+                           "active-changed",
+                           G_CALLBACK (photos_tracker_controller_refresh_for_object),
+                           self,
+                           G_CONNECT_SWAPPED);
 
   self->srch_mtch_mngr = g_object_ref (state->srch_mtch_mngr);
-  g_signal_connect_swapped (self->srch_mtch_mngr,
-                            "active-changed",
-                            G_CALLBACK (photos_tracker_search_controller_search_match_active_changed),
-                            self);
+  g_signal_connect_object (self->srch_mtch_mngr,
+                           "active-changed",
+                           G_CALLBACK (photos_tracker_search_controller_search_match_active_changed),
+                           self,
+                           G_CONNECT_SWAPPED);
 
   self->srch_typ_mngr = g_object_ref (state->srch_typ_mngr);
-  g_signal_connect_swapped (self->srch_typ_mngr,
-                            "active-changed",
-                            G_CALLBACK (photos_tracker_controller_refresh_for_object),
-                            self);
+  g_signal_connect_object (self->srch_typ_mngr,
+                           "active-changed",
+                           G_CALLBACK (photos_tracker_controller_refresh_for_object),
+                           self,
+                           G_CONNECT_SWAPPED);
 
   self->offset_cntrlr = photos_offset_search_controller_dup_singleton ();
 
   self->srch_cntrlr = g_object_ref (state->srch_cntrlr);
-  g_signal_connect_swapped (self->srch_cntrlr,
-                            "search-string-changed",
-                            G_CALLBACK (photos_tracker_controller_refresh_for_object),
-                            self);
+  g_signal_connect_object (self->srch_cntrlr,
+                           "search-string-changed",
+                           G_CALLBACK (photos_tracker_controller_refresh_for_object),
+                           self,
+                           G_CONNECT_SWAPPED);
 }
 
 


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