[tracker/ontology-cope] Bugfix, squash



commit 6359e18e42c6b5eb423a2d783b12ea12b7f47ac4
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Mar 23 18:16:26 2010 +0100

    Bugfix, squash

 src/libtracker-data/tracker-data-manager.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 6b4f29a..b10d054 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -72,6 +72,7 @@
 static gchar              *ontologies_dir;
 static gboolean            initialized;
 static gboolean            in_journal_replay;
+static gint                max_service_id = 0;
 
 void
 tracker_data_ontology_load_statement (const gchar *ontology_path,
@@ -1415,10 +1416,8 @@ get_new_service_id (TrackerDBInterface *iface)
 	/* Don't intermix this thing with tracker_data_update_get_new_service_id,
 	 * if you use this, know what you are doing! */
 
-	static gint         max = 0;
-
-	if (G_LIKELY (max != 0)) {
-		return ++max;
+	if (G_LIKELY (max_service_id != 0)) {
+		return ++max_service_id;
 	}
 
 	iface = tracker_db_manager_get_db_interface ();
@@ -1430,11 +1429,11 @@ get_new_service_id (TrackerDBInterface *iface)
 
 	if (cursor) {
 		tracker_db_cursor_iter_next (cursor);
-		max = MAX (tracker_db_cursor_get_int (cursor, 0), max);
+		max_service_id = MAX (tracker_db_cursor_get_int (cursor, 0), max_service_id);
 		g_object_unref (cursor);
 	}
 
-	return ++max;
+	return ++max_service_id;
 }
 
 gboolean
@@ -1453,6 +1452,7 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
 	gint max_id = 0;
 
 	tracker_data_update_init ();
+	max_service_id = 0;
 
 	/* First set defaults for return values */
 	if (first_time) {
@@ -1788,6 +1788,7 @@ tracker_data_manager_shutdown (void)
 	/* Make sure we shutdown all other modules we depend on */
 	tracker_db_journal_shutdown ();
 	tracker_db_manager_shutdown ();
+	max_service_id = 0;
 	tracker_ontologies_shutdown ();
 	tracker_data_update_shutdown ();
 



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