[anjuta/sdb-core-trans] symbol-db: fixed some warnings on engine unreffing.



commit 64b22659bd9d7eb9b48214b20fcc95401cc5a6d2
Author: Massimo Corà <mcora src gnome org>
Date:   Mon Jul 12 14:34:48 2010 +0200

    symbol-db: fixed some warnings on engine unreffing.

 plugins/symbol-db/benchmark/sqlite/Makefile.am    |    2 --
 plugins/symbol-db/benchmark/symbol-db/benchmark.c |   13 +++++++++----
 plugins/symbol-db/symbol-db-engine-core.c         |   21 +++++++++++++++------
 3 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/plugins/symbol-db/benchmark/sqlite/Makefile.am b/plugins/symbol-db/benchmark/sqlite/Makefile.am
index 2a59777..d0ee34b 100644
--- a/plugins/symbol-db/benchmark/sqlite/Makefile.am
+++ b/plugins/symbol-db/benchmark/sqlite/Makefile.am
@@ -15,8 +15,6 @@ benchmark_sqlite_LDFLAGS = \
 	$(PLUGIN_SYMBOL_DB_LIBS) \
 	`pkg-config --libs sqlite3`
 	
-benchmark_libgda_LDADD = ../../libanjuta-symbol-db.la
-
 
 ## File created by the gnome-build tools
 
diff --git a/plugins/symbol-db/benchmark/symbol-db/benchmark.c b/plugins/symbol-db/benchmark/symbol-db/benchmark.c
index 05fcea3..f021d3f 100644
--- a/plugins/symbol-db/benchmark/symbol-db/benchmark.c
+++ b/plugins/symbol-db/benchmark/symbol-db/benchmark.c
@@ -4,6 +4,8 @@
 #include "../../symbol-db-engine.h"
 #include <gtk/gtk.h>
 
+static GMainLoop *main_loop;
+
 static GPtrArray * 
 get_source_files_by_mime (const gchar* dir, const GHashTable *mimes)
 {
@@ -70,7 +72,8 @@ on_scan_end (SymbolDBEngine* engine, gpointer user_data)
 	g_message ("on_scan_end  ()");
 	symbol_db_engine_close_db (engine);
 	g_object_unref (engine);
-  	exit(0);
+
+ 	g_main_loop_quit(main_loop);
 }
 
 int main (int argc, char** argv)
@@ -82,8 +85,10 @@ int main (int argc, char** argv)
 	GFile *g_dir;
 	GHashTable *mimes;
 	int i;
-	
-  	gtk_init(&argc, &argv);
+
+	main_loop = g_main_loop_new (NULL, FALSE);
+
+	gtk_init(&argc, &argv);
   	g_thread_init (NULL);
 	gda_init ();
 	
@@ -133,7 +138,7 @@ int main (int argc, char** argv)
 	g_free (root_dir);
 	g_object_unref (g_dir);
 	
-	gtk_main();
+	g_main_loop_run (main_loop);
 	
 	return 0;
 }
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index eb98716..c726b5f 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -1037,13 +1037,19 @@ sdb_engine_timeout_trigger_signals (gpointer user_data)
 	g_return_val_if_fail (user_data != NULL, FALSE);	
 	priv = dbe->priv;		
 
-	if (g_async_queue_length (priv->signals_queue) > 0)
+	if (priv->signals_queue != NULL && 
+	    g_async_queue_length (priv->signals_queue) > 0)
 	{
 		gpointer tmp;
 		gpointer sign = NULL;
 		gsize real_signal;
-	
-		while ((sign = g_async_queue_try_pop (priv->signals_queue)) != NULL)  
+
+
+
+
+		
+		while (priv->signals_queue != NULL &&  
+		    (sign = g_async_queue_try_pop (priv->signals_queue)) != NULL)  
 		{
 			if (sign == NULL) 
 			{
@@ -1110,7 +1116,8 @@ sdb_engine_timeout_trigger_signals (gpointer user_data)
 		priv->trigger_closure_retries++;
 	}
 	
-	if (g_thread_pool_unprocessed (priv->thread_pool) == 0 &&
+	if (priv->thread_pool != NULL &&
+	    g_thread_pool_unprocessed (priv->thread_pool) == 0 &&
 		g_thread_pool_get_num_threads (priv->thread_pool) == 0)
 	{
 		/* remove the trigger coz we don't need it anymore... */
@@ -1949,9 +1956,11 @@ sdb_engine_finalize (GObject * object)
 
 	if (priv->sym_type_conversion_hash)
 		g_hash_table_destroy (priv->sym_type_conversion_hash);
+	priv->sym_type_conversion_hash = NULL;
 	
 	if (priv->signals_queue)
 		g_async_queue_unref (priv->signals_queue);
+	priv->signals_queue = NULL;
 	
 	sdb_engine_clear_caches (dbe);
 	sdb_engine_clear_tablemaps (dbe);
@@ -4464,10 +4473,10 @@ sdb_engine_add_new_symbol (SymbolDBEngine * dbe, const tagEntry * tag_entry,
 													 (GdaStatement*)stmt, 
 													 (GdaSet*)plist, &last_inserted,
 													 &error);
-
+	
 	if (error)
 	{
-		g_warning ("SQL parsing failed: %s",error->message);
+		DEBUG_PRINT ("SQL parsing failed: %s", error->message);
 		g_error_free (error);
 	}
 	



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