[tracker/rss-enclosures] tracker-db-manager: Remove interfaces from hashtable as soon as the thread finalizes.
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] tracker-db-manager: Remove interfaces from hashtable as soon as the thread finalizes.
- Date: Mon, 3 May 2010 00:40:03 +0000 (UTC)
commit ad059506d811703a9c28934345078691c8837eae
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 16 16:46:03 2010 +0200
tracker-db-manager: Remove interfaces from hashtable as soon as the thread finalizes.
src/libtracker-db/tracker-db-manager.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index a184887..9641d28 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -628,6 +628,18 @@ tracker_db_manager_init_locations (void)
locations_initialized = TRUE;
}
+static void
+free_thread_interface (gpointer data)
+{
+ TrackerDBInterface *interface = data;
+
+ g_static_mutex_lock (&thread_ifaces_mutex);
+ g_hash_table_remove (thread_ifaces, g_thread_self ());
+ g_static_mutex_unlock (&thread_ifaces_mutex);
+
+ g_object_unref (interface);
+}
+
gboolean
tracker_db_manager_init (TrackerDBManagerFlags flags,
gboolean *first_time,
@@ -898,7 +910,7 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
TRACKER_DB_CONTENTS);
}
- g_static_private_set (&interface_data_key, resources_iface, (GDestroyNotify) g_object_unref);
+ g_static_private_set (&interface_data_key, resources_iface, free_thread_interface);
g_static_mutex_lock (&thread_ifaces_mutex);
g_hash_table_insert (thread_ifaces, g_thread_self (), resources_iface);
@@ -1205,9 +1217,7 @@ tracker_db_manager_get_db_interface (void)
tracker_db_interface_sqlite_fts_init (TRACKER_DB_INTERFACE_SQLITE (interface), FALSE);
- g_static_private_set (&interface_data_key,
- interface,
- (GDestroyNotify) g_object_unref);
+ g_static_private_set (&interface_data_key, interface, free_thread_interface);
g_static_mutex_lock (&thread_ifaces_mutex);
g_hash_table_insert (thread_ifaces, g_thread_self (), interface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]