[anjuta] symbol-db: fixed some null connection warnings.



commit 7b9f2b42bf1bc1212ac50222f387a4c6c4101b47
Author: Massimo Corà <mcora src gnome org>
Date:   Sat Dec 12 20:59:38 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 87666a8..77e9afc 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 ff7950a..0a51505 100644
--- a/plugins/symbol-db/symbol-db-search-command.c
+++ b/plugins/symbol-db/symbol-db-search-command.c
@@ -98,16 +98,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);	
 
@@ -121,16 +126,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]