[tracker] libtracker-data: Fix race condition on shutdown



commit 80f59d2a2c92cef9f3b1622d623a6011a1c4ed82
Author: Jürg Billeter <j bitron ch>
Date:   Wed Feb 9 17:08:37 2011 +0100

    libtracker-data: Fix race condition on shutdown
    
    g_static_private_free is not thread-safe, so do not use it and rely on
    TLS cleanup instead. This fixes critical g_object_unref warnings on
    shutdown.

 src/libtracker-data/tracker-db-manager.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index ad76f6d..d0e08aa 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -1251,8 +1251,10 @@ tracker_db_manager_shutdown (void)
 		global_iface = NULL;
 	}
 
-	/* shutdown db interfaces in all threads */
-	g_static_private_free (&interface_data_key);
+	/* shutdown db interface in current thread
+	 * interfaces in other threads are shut down by TLS cleanup
+	 * do not use g_static_private_free as it does not appear to be thread-safe */
+	g_static_private_set (&interface_data_key, NULL, NULL);
 
 	/* Since we don't reference this enum anywhere, we do
 	 * it here to make sure it exists when we call



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]