Commit 66fc15e9 authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent f12117df
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment