[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 104/116] libtracker-miner: Dispose cached events on MONITOR_EVENT_DELETED
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/shuffle-libtracker-miner: 104/116] libtracker-miner: Dispose cached events on MONITOR_EVENT_DELETED
- Date: Thu, 12 Dec 2019 10:29:38 +0000 (UTC)
commit 4203a26a604f1fa1442d5d65c7826701544f9cfd
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 4 13:28:12 2019 +0100
libtracker-miner: Dispose cached events on MONITOR_EVENT_DELETED
I don't know if this is possible, but in case that happens we should
drop the event either way, and neutralize CREATED+DELETED events early
on.
src/libtracker-miner/tracker-monitor.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 342caaaa6..e4276dbb4 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -659,6 +659,7 @@ monitor_event_cb (GFileMonitor *file_monitor,
gchar *other_file_uri;
gboolean is_directory = FALSE;
TrackerMonitorPrivate *priv;
+ gpointer value;
monitor = user_data;
priv = tracker_monitor_get_instance_private (monitor);
@@ -707,6 +708,18 @@ monitor_event_cb (GFileMonitor *file_monitor,
}
break;
case G_FILE_MONITOR_EVENT_DELETED:
+ if (g_hash_table_lookup_extended (priv->cached_events,
+ file, NULL, &value) &&
+ GPOINTER_TO_UINT (value) == G_FILE_MONITOR_EVENT_CREATED) {
+ /* Consume both the cached CREATED event and this one */
+ g_hash_table_remove (priv->cached_events, file);
+ break;
+ }
+
+ /* In any case, cached events are stale */
+ g_hash_table_remove (priv->cached_events, file);
+
+ /* Fall through */
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
emit_signal_for_event (monitor, event_type,
is_directory, file, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]