tracker r2847 - in trunk: . src/trackerd
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2847 - in trunk: . src/trackerd
- Date: Tue, 27 Jan 2009 17:50:28 +0000 (UTC)
Author: carlosg
Date: Tue Jan 27 17:50:28 2009
New Revision: 2847
URL: http://svn.gnome.org/viewvc/tracker?rev=2847&view=rev
Log:
2009-01-27 Carlos Garnacho <carlos imendio com>
* src/trackerd/tracker-monitor.c (tracker_monitor_init)
(libinotify_monitor_event_cb): Make cached events hash table keep a
reference as the key, so it doesn't get destroyed if the value is
replaced.
(get_module_name_from_gfile): Do not possibly use already freed
memory.
(libinotify_cached_events_timeout_cb): Discard cached events for
deleted items.
Modified:
trunk/ChangeLog
trunk/src/trackerd/tracker-monitor.c
Modified: trunk/src/trackerd/tracker-monitor.c
==============================================================================
--- trunk/src/trackerd/tracker-monitor.c (original)
+++ trunk/src/trackerd/tracker-monitor.c Tue Jan 27 17:50:28 2009
@@ -235,7 +235,7 @@
priv->cached_events =
g_hash_table_new_full (g_file_hash,
(GEqualFunc) g_file_equal,
- NULL,
+ g_object_unref,
event_data_free);
#endif /* USE_LIBINOTIFY */
@@ -532,7 +532,6 @@
}
module_name = get_queue_from_gfile (monitor->private->modules, parent);
- g_object_unref (parent);
if (!module_name) {
gchar *parent_path;
@@ -551,8 +550,6 @@
g_free (parent_path);
g_free (child_path);
-
- return NULL;
} else {
if (is_directory) {
gchar *child_path;
@@ -562,6 +559,8 @@
g_free (child_path);
}
}
+
+ g_object_unref (parent);
}
return module_name;
@@ -831,6 +830,12 @@
event->file,
&is_directory);
+ if (!module_name) {
+ /* File was deleted before we could check its cached events, just discard it */
+ g_hash_table_iter_remove (&iter);
+ continue;
+ }
+
if (seconds < MAX (2, tracker_module_config_get_scan_timeout (module_name))) {
continue;
}
@@ -1056,7 +1061,7 @@
data = event_data_new (file, event_type);
g_hash_table_insert (monitor->private->cached_events,
- data->file,
+ g_object_ref (data->file),
data);
set_up_cache_timeout = TRUE;
@@ -1101,7 +1106,7 @@
data = event_data_new (file, event_type);
g_hash_table_insert (monitor->private->cached_events,
- data->file,
+ g_object_ref (data->file),
data);
set_up_cache_timeout = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]