[gnome-photos] item-manager: Fix the lifetime of the changes-pending handler
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] item-manager: Fix the lifetime of the changes-pending handler
- Date: Wed, 22 Jun 2016 10:24:23 +0000 (UTC)
commit 4207f4c289a8ec4d5e21d110a12e20270b031a0d
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jun 21 18:34:02 2016 +0200
item-manager: Fix the lifetime of the changes-pending handler
TrackerChangeMonitor is a singleton which can outlive the ItemManager.
Therefore, we should use g_signal_connect_object to ensure that the
TrackerChangeMonitor::changes-pending handler is disconnected when
ItemManager is destroyed.
Note that right now ItemManager is the only user of
TrackerChangeMonitor. So this shouldn't have been a problem. However,
TrackerChangeMonitor doesn't cancel its internal asynchronous
operations and sources during destruction. It takes a reference on
itself to stay alive and can thus outlive the ItemManager.
https://bugzilla.gnome.org/show_bug.cgi?id=767892
src/photos-item-manager.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 8f1e662..18abc84 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -447,10 +447,11 @@ photos_item_manager_init (PhotosItemManager *self)
self->monitor = photos_tracker_change_monitor_dup_singleton (NULL, NULL);
if (G_LIKELY (self->monitor != NULL))
- g_signal_connect_swapped (self->monitor,
- "changes-pending",
- G_CALLBACK (photos_item_manager_changes_pending),
- self);
+ g_signal_connect_object (self->monitor,
+ "changes-pending",
+ G_CALLBACK (photos_item_manager_changes_pending),
+ self,
+ G_CONNECT_SWAPPED);
self->fullscreen = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]