diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-02-22 00:40:34 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-02-22 00:40:34 +0800 |
commit | 170c60d49682f73c4a47c16f04ef5f4c06e8c90c (patch) | |
tree | 0ce012f754be56d6c0c42152ad79bf3b483242b3 /lib/widgets/ephy-toolbars-group.c | |
parent | 19499e453f3efa2208c9905058476d0b1fba68e3 (diff) | |
download | gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.gz gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.bz2 gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.lz gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.xz gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.zst gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.zip |
Fix crashes with multiple windows open
2003-02-21 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/egg/egg-action.c: (egg_action_remove_proxy):
* lib/widgets/ephy-editable-toolbar.c: (get_item_widget),
(connect_item_drag_source), (disconnect_item_drag_source),
(setup_toolbar), (setup_item), (ensure_toolbar_min_size):
* lib/widgets/ephy-toolbars-group.c: (toolbars_toolbar_new),
(toolbars_item_new), (free_toolbar_node), (free_item_node),
(ephy_toolbars_group_to_string), (ephy_toolbars_group_get_path):
* lib/widgets/ephy-toolbars-group.h:
Fix crashes with multiple windows open
Diffstat (limited to 'lib/widgets/ephy-toolbars-group.c')
-rwxr-xr-x | lib/widgets/ephy-toolbars-group.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/widgets/ephy-toolbars-group.c b/lib/widgets/ephy-toolbars-group.c index 98e36feb9..3711efe2d 100755 --- a/lib/widgets/ephy-toolbars-group.c +++ b/lib/widgets/ephy-toolbars-group.c @@ -129,9 +129,12 @@ static EphyToolbarsToolbar * toolbars_toolbar_new (void) { EphyToolbarsToolbar *toolbar; + static int id = 0; toolbar = g_new0 (EphyToolbarsToolbar, 1); - toolbar->widget = NULL; + toolbar->id = g_strdup_printf ("Toolbar%d", id); + + id++; return toolbar; } @@ -140,13 +143,16 @@ static EphyToolbarsItem * toolbars_item_new (const char *action, gboolean separator) { EphyToolbarsItem *item; + static int id = 0; g_return_val_if_fail (action != NULL, NULL); item = g_new0 (EphyToolbarsItem, 1); item->action = g_strdup (action); item->separator = separator; - item->widget = NULL; + item->id = g_strdup_printf ("TI%d", id); + + id++; return item; } @@ -156,6 +162,7 @@ free_toolbar_node (EphyToolbarsToolbar *toolbar) { g_return_if_fail (toolbar != NULL); + g_free (toolbar->id); g_free (toolbar); } @@ -165,6 +172,7 @@ free_item_node (EphyToolbarsItem *item) g_return_if_fail (item != NULL); g_free (item->action); + g_free (item->id); g_free (item); } @@ -382,16 +390,16 @@ ephy_toolbars_group_to_string (EphyToolbarsGroup *t) { g_string_append_printf (s, "<placeholder name=\"PlaceHolder%d-%d\">" - "<separator name=\"TS\"/>" - "</placeholder>\n", i, k); + "<separator name=\"%s\"/>" + "</placeholder>\n", i, k, item->id); } else { g_string_append_printf (s, "<placeholder name=\"PlaceHolder%d-%d\">" - "<toolitem name=\"TI%s\" verb=\"%s\"/>" + "<toolitem name=\"%s\" verb=\"%s\"/>" "</placeholder>\n", - i, k, item->action, item->action); + i, k, item->id, item->action); } i++; } @@ -617,27 +625,27 @@ ephy_toolbars_group_get_path (EphyToolbarsGroup *t, GNode *node; char *path = NULL; EphyToolbarsItem *titem; + EphyToolbarsToolbar *toolbar; g_return_val_if_fail (IS_EPHY_TOOLBARS_GROUP (t), NULL); node = g_node_find (t->priv->toolbars, G_IN_ORDER, G_TRAVERSE_ALL, item); g_return_val_if_fail (node != NULL, NULL); titem = (EphyToolbarsItem *)node->data; + toolbar = (EphyToolbarsToolbar *)node->data; switch (g_node_depth (node)) { case 2: - path = g_strdup_printf ("/Toolbar%d", - g_node_child_position (node->parent, node)); + path = g_strdup_printf ("/%s", toolbar->id); break; case 3: path = g_strdup_printf - ("/Toolbar%d/PlaceHolder%d-%d/%s%s", + ("/Toolbar%d/PlaceHolder%d-%d/%s", g_node_child_position (node->parent->parent, node->parent), g_node_child_position (node->parent, node), g_node_child_position (node->parent->parent, node->parent), - titem->separator ? "TS" : "TI", - titem->separator ? "" : titem->action); + titem->id); break; default: g_assert_not_reached (); |