From 5d4d9eba1c241a12304d74d3c2bea7e80a853cd6 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 21 Feb 2003 19:33:45 +0000 Subject: Dont create duped actions, fix crash on exit 2003-02-21 Marco Pesenti Gritti * src/toolbar.c: (get_bookmark_action), (toolbar_get_action): Dont create duped actions, fix crash on exit --- ChangeLog | 6 ++++++ src/toolbar.c | 37 ++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index bace23913..af8456d21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-02-21 Marco Pesenti Gritti + + * src/toolbar.c: (get_bookmark_action), (toolbar_get_action): + + Dont create duped actions, fix crash on exit + 2003-02-21 Takayuki KUSANO * configure.in: added ja.po to ALL_LINGUAS diff --git a/src/toolbar.c b/src/toolbar.c index eecac5c11..7eb0ee1ad 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -113,14 +113,12 @@ go_location_cb (EggAction *action, char *location, EphyWindow *window) } static EggAction * -get_bookmark_action (Toolbar *t, EphyBookmarks *bookmarks, gulong id) +get_bookmark_action (Toolbar *t, EphyBookmarks *bookmarks, gulong id, const char *action_name) { - char action_name[255]; EggAction *action; LOG ("Creating action for bookmark id %ld", id) - snprintf (action_name, 255, "GoBookmarkId%ld", id); action = ephy_bookmark_action_new (action_name, id); g_signal_connect (action, "go_location", @@ -140,6 +138,7 @@ toolbar_get_action (EphyEditableToolbar *etoolbar, EggAction *action = NULL; EphyBookmarks *bookmarks; gulong id = 0; + char action_name[255]; bookmarks = ephy_shell_get_bookmarks (ephy_shell); @@ -172,32 +171,32 @@ toolbar_get_action (EphyEditableToolbar *etoolbar, gtk_widget_destroy (new_bookmark); } - if (id != 0) - { - action = get_bookmark_action (t, bookmarks, id); - } - else - { - action = NULL; - } - g_list_foreach (uris, (GFunc)g_free, NULL); g_list_free (uris); } - - if (action == NULL) + else if (g_str_has_prefix (name, "GoBookmarkId")) { - action = EPHY_EDITABLE_TOOLBAR_CLASS - (parent_class)->get_action (etoolbar, type, name); + if (!ephy_str_to_int (name + strlen ("GoBookmarkId"), &id)) + { + id = 0; + } } - if (action == NULL && g_str_has_prefix (name, "GoBookmarkId")) + if (id != 0) { - if (ephy_str_to_int (name + strlen ("GoBookmarkId"), &id)) + snprintf (action_name, 255, "GoBookmarkId%ld", id); + action = EPHY_EDITABLE_TOOLBAR_CLASS + (parent_class)->get_action (etoolbar, NULL, action_name); + if (action == NULL) { - action = get_bookmark_action (t, bookmarks, id); + action = get_bookmark_action (t, bookmarks, id, action_name); } } + else + { + action = EPHY_EDITABLE_TOOLBAR_CLASS + (parent_class)->get_action (etoolbar, type, name); + } return action; } -- cgit v1.2.3