Fixed a crash when switching between several filetypes.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@771 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-08-28 16:27:16 +00:00
parent 89824be669
commit b362185772
3 changed files with 21 additions and 0 deletions

View File

@ -2,6 +2,8 @@
* geany.glade, src/interface.c: Fixed typo in a tooltip text.
* THANKS, src/about.c: Added translator credits.
* src/treeviews.c, src/utils.c:
Fixed a crash when switching between several filetypes.
2006-08-27 Frank Lanitz <frank@frank.uvena.de>

View File

@ -58,6 +58,17 @@ void treeviews_prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
void treeviews_init_tag_list(gint idx)
{
// init all GtkTreeIters with -1 to make them invalid to avoid crashes when switching between
// filetypes(e.g. config file to Python crashes Geany without this)
tv.tag_function.stamp = -1;
tv.tag_class.stamp = -1;
tv.tag_member.stamp = -1;
tv.tag_macro.stamp = -1;
tv.tag_variable.stamp = -1;
tv.tag_namespace.stamp = -1;
tv.tag_struct.stamp = -1;
tv.tag_other.stamp = -1;
switch (doc_list[idx].file_type->id)
{
case GEANY_FILETYPES_DOCBOOK:

View File

@ -742,6 +742,7 @@ void utils_update_tag_list(gint idx, gboolean update)
case tm_tag_prototype_t:
case tm_tag_function_t:
{
if (tv.tag_function.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_function));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
@ -749,18 +750,21 @@ void utils_update_tag_list(gint idx, gboolean update)
case tm_tag_macro_t:
case tm_tag_macro_with_arg_t:
{
if (tv.tag_macro.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_macro));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
}
case tm_tag_class_t:
{
if (tv.tag_class.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_class));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
}
case tm_tag_member_t:
{
if (tv.tag_member.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_member));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
@ -770,24 +774,28 @@ void utils_update_tag_list(gint idx, gboolean update)
case tm_tag_union_t:
case tm_tag_struct_t:
{
if (tv.tag_struct.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_struct));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
}
case tm_tag_variable_t:
{
if (tv.tag_variable.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_variable));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
}
case tm_tag_namespace_t:
{
if (tv.tag_namespace.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_namespace));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
break;
}
default:
{
if (tv.tag_other.stamp == -1) break;
gtk_tree_store_append(doc_list[idx].tag_store, &iter, &(tv.tag_other));
gtk_tree_store_set(doc_list[idx].tag_store, &iter, 0, ((GeanySymbol*)tmp->data)->str, -1);
}