[anjuta/gnome-3-4] symbol-db: Don't crash if project was moved to another location
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/gnome-3-4] symbol-db: Don't crash if project was moved to another location
- Date: Sat, 28 Jul 2012 09:52:02 +0000 (UTC)
commit 9f0c4cbd2d3303a9522aa980e29f80f8b60768ce
Author: Johannes Schmid <jhs gnome org>
Date: Sat Jun 23 13:58:03 2012 +0200
symbol-db: Don't crash if project was moved to another location
The method didn't check if the string value given to g_hash_table_replace was
non-NULL.
plugins/symbol-db/plugin.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index 86c3804..3a41e04 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -1372,45 +1372,43 @@ do_check_offline_files_changed (SymbolDBPlugin *sdb_plugin)
prj_elements_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL, g_free);
- node = prj_elements_list;
- while (node != NULL)
+ for (node = prj_elements_list; node != NULL; node = g_list_next (node))
{
GFile *gfile;
gchar *filename;
+ gchar *db_path;
gfile = node->data;
+ if (!gfile)
+ continue;
if ((filename = g_file_get_path (gfile)) == NULL ||
- g_strcmp0 (filename, "") == 0)
+ !strlen (filename))
{
- if (gfile)
- g_object_unref (gfile);
+ g_object_unref (gfile);
- node = g_list_next (node);
continue;
}
/* test its existence */
if (g_file_query_exists (gfile, NULL) == FALSE)
{
- if (gfile)
- g_object_unref (gfile);
+ g_object_unref (gfile);
- node = g_list_next (node);
continue;
}
/* Use g_hash_table_replace instead of g_hash_table_insert because the key
* and the value use the same block of memory, both must be changed at
* the same time. */
- g_hash_table_replace (prj_elements_hash,
- (gpointer) symbol_db_util_get_file_db_path
- (sdb_plugin->sdbe_project,
- filename),
- filename);
+ db_path = symbol_db_util_get_file_db_path (sdb_plugin->sdbe_project,
+ filename);
+
+ if (db_path)
+ g_hash_table_replace (prj_elements_hash,
+ db_path,
+ filename);
g_object_unref (gfile);
-
- node = g_list_next (node);
}
@@ -2113,11 +2111,11 @@ symbol_db_activate (AnjutaPlugin *plugin)
G_CALLBACK (on_project_loaded), sdb_plugin);
/* Create widgets */
- sdb_plugin->dbv_main = gtk_vbox_new(FALSE, 5);
+ sdb_plugin->dbv_main = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
sdb_plugin->dbv_notebook = gtk_notebook_new();
gtk_notebook_set_show_border (GTK_NOTEBOOK (sdb_plugin->dbv_notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (sdb_plugin->dbv_notebook), FALSE);
- sdb_plugin->dbv_hbox = gtk_hbox_new (FALSE, 1);
+ sdb_plugin->dbv_hbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
label = gtk_label_new (_("Symbols"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]