[tracker] libtracker-miner: Add extra reference around file deletion
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Add extra reference around file deletion
- Date: Mon, 15 Feb 2016 17:04:05 +0000 (UTC)
commit 4057ee9d7c051748c71fce6e4ffd15e012c5da9a
Author: Haithem BEN GHORBAL <haithem benghorbal gmail com>
Date: Sun Feb 14 20:05:22 2016 +0100
libtracker-miner: Add extra reference around file deletion
TrackerFileNotifier::file-deleted might have removed the last reference
to the given file, make sure it lives a bit longer for the remaining
operations to finish.
src/libtracker-miner/tracker-file-notifier.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index d4d8ba8..76c1e40 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1162,12 +1162,20 @@ monitor_item_deleted_cb (TrackerMonitor *monitor,
/* Fetch the interned copy */
canonical = tracker_file_system_get_file (priv->file_system,
file, file_type, NULL);
+
+ /* tracker_file_system_forget_files() might already have been
+ * called on this file. In this case, the object might become
+ * invalid when returning from g_signal_emit(). Take a
+ * reference in order to prevent that.
+ */
+ g_object_ref (canonical);
g_signal_emit (notifier, signals[FILE_DELETED], 0, canonical);
/* Remove the file from the cache (works recursively for directories) */
tracker_file_system_forget_files (priv->file_system,
canonical,
G_FILE_TYPE_UNKNOWN);
+ g_object_unref (canonical);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]