Fix invalid tree iter access when using tv_iters.tag_other but not

using tv_iters.tag_variable.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4416 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-11-10 18:37:23 +00:00
parent 9de2456168
commit 8f9336abef
2 changed files with 23 additions and 8 deletions

View File

@ -2,6 +2,9 @@
* tagmanager/perl.c: * tagmanager/perl.c:
Fix Geany segfault with constant tags (#2895168). Fix Geany segfault with constant tags (#2895168).
* src/symbols.c:
Fix invalid tree iter access when using tv_iters.tag_other but not
using tv_iters.tag_variable.
2009-11-09 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2009-11-09 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -657,7 +657,7 @@ static void add_top_level_items(GeanyDocument *doc)
&(tv_iters.tag_function), _("Functions"), "classviewer-method", &(tv_iters.tag_function), _("Functions"), "classviewer-method",
&(tv_iters.tag_macro), _("Labels"), NULL, &(tv_iters.tag_macro), _("Labels"), NULL,
&(tv_iters.tag_type), _("Constants"), NULL, &(tv_iters.tag_type), _("Constants"), NULL,
&(tv_iters.tag_other), _("Other"), NULL, &(tv_iters.tag_other), _("Other"), "classviewer-other",
NULL); NULL);
break; break;
} }
@ -1061,6 +1061,21 @@ static GtkTreeIter *get_tag_type_iter(TMTagType tag_type, filetype_id ft_id)
} }
static GdkPixbuf *get_child_icon(GtkTreeStore *tree_store, GtkTreeIter *parent)
{
GdkPixbuf *icon = NULL;
if (parent == &tv_iters.tag_other)
{
return get_tag_icon("classviewer-var");
}
/* copy parent icon */
gtk_tree_model_get(GTK_TREE_MODEL(tree_store), parent,
SYMBOLS_COLUMN_ICON, &icon, -1);
return icon;
}
static void add_tree_tag(GeanyDocument *doc, const TMTag *tag, GHashTable *parent_hash) static void add_tree_tag(GeanyDocument *doc, const TMTag *tag, GHashTable *parent_hash)
{ {
filetype_id ft_id = FILETYPE_ID(doc->file_type); filetype_id ft_id = FILETYPE_ID(doc->file_type);
@ -1074,14 +1089,11 @@ static void add_tree_tag(GeanyDocument *doc, const TMTag *tag, GHashTable *paren
const gchar *name; const gchar *name;
const gchar *parent_name = get_parent_name(tag, ft_id); const gchar *parent_name = get_parent_name(tag, ft_id);
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeIter *icon_iter = NULL, *child = NULL; GtkTreeIter *child = NULL;
GdkPixbuf *icon = NULL; GdkPixbuf *icon = NULL;
child = &iter; child = &iter;
icon_iter = (parent != &tv_iters.tag_other) ? parent : &tv_iters.tag_variable; icon = get_child_icon(tree_store, parent);
gtk_tree_model_get(GTK_TREE_MODEL(tree_store), icon_iter,
SYMBOLS_COLUMN_ICON, &icon, -1);
if (parent_name) if (parent_name)
{ {