GNOME Bugzilla – Bug 756877
tracker-file-notifier: Fix the lifetime of the internal async operations
Last modified: 2015-10-20 17:57:56 UTC
The internal async operations in TrackerFileNotifier don't take a ref on the instance to keep it alive. Instead, they are controlled by a private GCancellable, which is supposed to be cancelled when the instance is destroyed. Therefore, we cannot touch the instance once G_IO_ERROR_CANCELLED has been raised because it has been destroyed. Secondly, it is not obvious to me that the private GCancellable is actually cancelled during destruction. It is important because merely unreffing it won't cancel it, and the async operations won't know that the instance is gone.
Created attachment 313760 [details] [review] libtracker-miner: Abort async operations once the instance is gone
(In reply to Debarshi Ray from comment #0) > Secondly, it is not obvious to me that the private GCancellable is actually > cancelled during destruction. It is important because merely unreffing it > won't cancel it, and the async operations won't know that the instance is > gone. I am sure that it is not being cancelled. g_cancellable_cancel is only called from tracker_file_notifier_stop and indexing_tree_directory_removed; and g_cancellable_reset is only called from crawl_directory_in_current_root. None of these are called before we drop the reference in finalize.
Created attachment 313764 [details] [review] libtracker-miner: Cancel pending async operations during destruction
Review of attachment 313760 [details] [review]: Looks good to me. Keep in mind I just branched yesterday :)
Review of attachment 313764 [details] [review]: Yup
Created attachment 313769 [details] [review] [tracker-1.4] libtracker-miner: Abort async operations once the instance is gone
Created attachment 313770 [details] [review] [tracker-1.2] libtracker-miner: Abort async operations once the instance is gone
Thanks Carlos. Pushed to master, tracker-1.6, tracker-1.4 and tracker-1.2.