Fix a segfault on Go to tag defn/decl if no files have tags. Add utils_find_tm_tag
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@516 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
2aa7ae45a2
commit
cee4ebf37c
@ -5,6 +5,9 @@
|
||||
* src/callbacks.c: Prevent a segfault if the VTE has not been loaded.
|
||||
* src/utils.c, src/utils.h, src/msgwindow.c:
|
||||
Add utils_get_current_time_string and fix getting the time string.
|
||||
* src/utils.c, src/utils.h, src/callbacks.c:
|
||||
Fix a segfault on Go to tag defn/decl if no files have tags.
|
||||
Add utils_find_tm_tag.
|
||||
|
||||
|
||||
2006-06-30 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
|
@ -1340,39 +1340,40 @@ on_goto_tag_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint type;
|
||||
guint i, j;
|
||||
guint j;
|
||||
const GPtrArray *tags;
|
||||
TMTag *tmtag;
|
||||
|
||||
if (menuitem == GTK_MENU_ITEM(lookup_widget(app->popup_menu, "goto_tag_definition1")))
|
||||
type = tm_tag_function_t;
|
||||
else
|
||||
type = tm_tag_prototype_t;
|
||||
|
||||
for (j = 0; j < app->tm_workspace->work_objects->len; j++)
|
||||
if (app->tm_workspace->work_objects != NULL)
|
||||
{
|
||||
tags = tm_tags_extract(TM_WORK_OBJECT(app->tm_workspace->work_objects->pdata[j])->tags_array, type);
|
||||
if (tags)
|
||||
for (j = 0; j < app->tm_workspace->work_objects->len; j++)
|
||||
{
|
||||
for (i = 0; i < tags->len; ++i)
|
||||
tags = tm_tags_extract(
|
||||
TM_WORK_OBJECT(app->tm_workspace->work_objects->pdata[j])->tags_array,
|
||||
type);
|
||||
if (tags == NULL) continue;
|
||||
|
||||
tmtag = utils_find_tm_tag(tags, current_word);
|
||||
if (tmtag != NULL)
|
||||
{
|
||||
if (utils_strcmp(TM_TAG(tags->pdata[i])->name, current_word))
|
||||
{
|
||||
if (! utils_goto_file_line(
|
||||
TM_TAG(tags->pdata[i])->atts.entry.file->work_object.file_name,
|
||||
TRUE,
|
||||
TM_TAG(tags->pdata[i])->atts.entry.line))
|
||||
{
|
||||
utils_beep();
|
||||
msgwin_status_add(_("Declaration or definition of \"%s()\" not found"), current_word);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (! utils_goto_file_line(
|
||||
tmtag->atts.entry.file->work_object.file_name,
|
||||
TRUE, tmtag->atts.entry.line)) break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if we are here, there was no match and we are beeping ;-)
|
||||
utils_beep();
|
||||
msgwin_status_add(_("Declaration or definition of \"%s()\" not found"), current_word);
|
||||
if (type == tm_tag_prototype_t)
|
||||
msgwin_status_add(_("Declaration of \"%s()\" not found"), current_word);
|
||||
else
|
||||
msgwin_status_add(_("Definition of \"%s()\" not found"), current_word);
|
||||
}
|
||||
|
||||
|
||||
|
14
src/utils.c
14
src/utils.c
@ -2496,3 +2496,17 @@ gchar *utils_get_current_time_string()
|
||||
}
|
||||
|
||||
|
||||
TMTag *utils_find_tm_tag(const GPtrArray *tags, const gchar *tag_name)
|
||||
{
|
||||
guint i;
|
||||
g_return_val_if_fail(tags != NULL, NULL);
|
||||
|
||||
for (i = 0; i < tags->len; ++i)
|
||||
{
|
||||
if (utils_strcmp(TM_TAG(tags->pdata[i])->name, tag_name))
|
||||
return TM_TAG(tags->pdata[i]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,4 +220,6 @@ void utils_parse_compiler_error_line(const gchar *string, gchar **filename, gint
|
||||
// returned string must be freed.
|
||||
gchar *utils_get_current_time_string();
|
||||
|
||||
TMTag *utils_find_tm_tag(const GPtrArray *tags, const gchar *tag_name);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user