[anjuta/gnome-2-28] symbol-db: fixed some null connection warnings.



commit 4be557417f5673e826664032f21822680b03ebd3
Author: Massimo Corà <mcora src gnome org>
Date:   Sun Dec 13 13:26:36 2009 +0100

    symbol-db: fixed some null connection warnings.
    
    These happened when an user was browsing non-project files.

 plugins/symbol-db/plugin.c                   |   27 ++++++++++-----
 plugins/symbol-db/symbol-db-search-command.c |   48 +++++++++++++++----------
 2 files changed, 47 insertions(+), 28 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index 2612a30..7d3f828 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -200,13 +200,17 @@ goto_file_tag (SymbolDBPlugin *sdb_plugin, const gchar *word,
 		{
 			engine = sdb_plugin->sdbe_globals;
 		}		
-						
-		iterator = symbol_db_engine_find_symbol_by_name_pattern (engine, 
-															 word,
-															 TRUE,
-															 SYMINFO_SIMPLE |
-															 SYMINFO_KIND |
-															 SYMINFO_FILE_PATH);
+
+		iterator = NULL;
+		if (symbol_db_engine_is_connected (engine)) 
+		{		
+			iterator = symbol_db_engine_find_symbol_by_name_pattern (engine, 
+																 word,
+																 TRUE,
+																 SYMINFO_SIMPLE |
+																 SYMINFO_KIND |
+																 SYMINFO_FILE_PATH);
+		}
 	
 		if (iterator != NULL && symbol_db_engine_iterator_get_n_items (iterator) > 0)
 		{
@@ -615,8 +619,13 @@ on_editor_saved (IAnjutaEditor *editor, GFile* file,
 		old_uri = NULL;
 
 	/* files_array will be freed once updating has taken place */
-	proc_id = symbol_db_engine_update_files_symbols (sdb_plugin->sdbe_project, 
-						sdb_plugin->project_root_dir, files_array, TRUE);
+	proc_id = 0;
+	if (symbol_db_engine_is_connected (sdb_plugin->sdbe_project))
+	{
+		proc_id = symbol_db_engine_update_files_symbols (sdb_plugin->sdbe_project, 
+							sdb_plugin->project_root_dir, files_array, TRUE);
+	}
+	
 	if (proc_id > 0)
 	{		
 		/* add a task so that scan_end_manager can manage this */
diff --git a/plugins/symbol-db/symbol-db-search-command.c b/plugins/symbol-db/symbol-db-search-command.c
index 0f4f472..5f17f85 100644
--- a/plugins/symbol-db/symbol-db-search-command.c
+++ b/plugins/symbol-db/symbol-db-search-command.c
@@ -92,16 +92,21 @@ do_search_file (SymbolDBSearchCommand *sdbsc)
 	{		
 		return NULL;
 	}
+
+	iterator = NULL;
+	if (symbol_db_engine_is_connected (priv->dbe)) 
+	{
 	
-	iterator = 
-		symbol_db_engine_find_symbol_by_name_pattern_on_file (priv->dbe,
-				    priv->pattern,
-					abs_file_path,
-					priv->match_types,
-					priv->include_types,
-					priv->results_limit,
-					priv->results_offset,
-					priv->info_fields);
+		iterator = 
+			symbol_db_engine_find_symbol_by_name_pattern_on_file (priv->dbe,
+					    priv->pattern,
+						abs_file_path,
+						priv->match_types,
+						priv->include_types,
+						priv->results_limit,
+						priv->results_offset,
+						priv->info_fields);
+	}
 	
 	g_free (abs_file_path);	
 
@@ -115,16 +120,21 @@ do_search_prj_glb (SymbolDBSearchCommand *sdbsc)
 	SymbolDBSearchCommandPriv *priv;	
 
 	priv = sdbsc->priv;
-	iterator = 		
-		symbol_db_engine_find_symbol_by_name_pattern_filtered (priv->dbe,
-					priv->pattern,
-					priv->match_types,
-					priv->include_types,
-					priv->filescope_search,
-					priv->session_packages,
-					priv->results_limit,
-					priv->results_offset,
-					priv->info_fields);	
+
+	iterator = NULL;
+	if (symbol_db_engine_is_connected (priv->dbe)) 
+	{
+		iterator = 		
+			symbol_db_engine_find_symbol_by_name_pattern_filtered (priv->dbe,
+						priv->pattern,
+						priv->match_types,
+						priv->include_types,
+						priv->filescope_search,
+						priv->session_packages,
+						priv->results_limit,
+						priv->results_offset,
+						priv->info_fields);
+	}
 	
 	return iterator;
 }



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