diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-02-21 21:29:37 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-02-21 21:29:37 +0800 |
commit | a3d3dccb3b0320900696f6a2246b07afb28766ec (patch) | |
tree | 7a9e8195d49f1dada7d36737ef3a0129d6545ba2 /lib/widgets/ephy-toolbars-group.c | |
parent | 9a390a3125826aeb7f62bdac0b6c31c576f688be (diff) | |
download | gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.tar gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.tar.gz gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.tar.bz2 gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.tar.lz gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.tar.xz gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.tar.zst gsoc2013-epiphany-a3d3dccb3b0320900696f6a2246b07afb28766ec.zip |
Add lots of debug code to solve these damned crashes. Dont create multiple
2003-02-21 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/widgets/ephy-editable-toolbar.c: (find_action),
(impl_get_action), (ui_update), (queue_ui_update),
(drag_data_received_cb), (drag_data_delete_cb), (drag_data_get_cb),
(connect_item_drag_source), (disconnect_item_drag_source),
(setup_toolbar), (setup_item), (ensure_toolbar_min_size),
(do_merge), (ensure_action), (group_changed_cb),
(ephy_editable_toolbar_set_group),
(ephy_editable_toolbar_set_merge), (hide_editor),
(editor_close_cb), (editor_add_toolbar_cb),
(editor_drag_data_received_cb), (editor_drag_data_delete_cb),
(setup_editor), (add_to_list), (update_editor_sheet),
(update_editor_position), (button_press_cb), (show_editor),
(set_action_sensitive), (ephy_editable_toolbar_edit):
* lib/widgets/ephy-toolbars-group.c: (ephy_toolbars_group_to_xml),
(toolbars_group_save), (toolbars_item_new), (free_toolbar_node),
(free_item_node), (ephy_toolbars_group_add_item),
(ephy_toolbars_group_add_toolbar), (load_defaults), (load_toolbar),
(ephy_toolbars_group_to_string),
(ephy_toolbars_group_remove_toolbar),
(ephy_toolbars_group_remove_item),
(ephy_toolbars_group_set_source), (is_item_in_toolbars),
(ephy_toolbars_group_foreach_available),
(ephy_toolbars_group_foreach_toolbar),
(ephy_toolbars_group_foreach_item), (ephy_toolbars_group_get_path):
* src/toolbar.c: (toolbar_get_action):
Add lots of debug code to solve these damned crashes.
Dont create multiple actions for the same bookmark.
There are two crashes that I can repro now. 1 Adding bookmarks
with more then one toolbar opened, and then open tbe.
2 Add multiple "links" to the same bookmark and then close.
But I'm sure xan can find more ;)
Diffstat (limited to 'lib/widgets/ephy-toolbars-group.c')
-rwxr-xr-x | lib/widgets/ephy-toolbars-group.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/lib/widgets/ephy-toolbars-group.c b/lib/widgets/ephy-toolbars-group.c index 753aca4a1..e923044f1 100755 --- a/lib/widgets/ephy-toolbars-group.c +++ b/lib/widgets/ephy-toolbars-group.c @@ -79,6 +79,8 @@ ephy_toolbars_group_to_xml (EphyToolbarsGroup *t) GNode *l1, *l2, *tl; xmlDocPtr doc; + g_return_val_if_fail (IS_EPHY_TOOLBARS_GROUP (t), NULL); + tl = t->priv->toolbars; xmlIndentTreeOutput = TRUE; @@ -116,6 +118,8 @@ toolbars_group_save (EphyToolbarsGroup *t) { xmlDocPtr doc; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t)); + doc = ephy_toolbars_group_to_xml (t); xmlSaveFormatFile (t->priv->user, doc, 1); xmlFreeDoc (doc); @@ -137,6 +141,8 @@ toolbars_item_new (const char *action, gboolean separator) { EphyToolbarsItem *item; + g_return_val_if_fail (action != NULL, NULL); + item = g_new0 (EphyToolbarsItem, 1); item->action = g_strdup (action); item->separator = separator; @@ -148,12 +154,16 @@ toolbars_item_new (const char *action, gboolean separator) static void free_toolbar_node (EphyToolbarsToolbar *toolbar) { + g_return_if_fail (toolbar != NULL); + g_free (toolbar); } static void free_item_node (EphyToolbarsItem *item) { + g_return_if_fail (item != NULL); + g_free (item->action); g_free (item); } @@ -187,12 +197,17 @@ ephy_toolbars_group_add_item (EphyToolbarsGroup *t, GNode *parent_node; GNode *sibling_node = NULL; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t)); + g_return_if_fail (parent != NULL); + g_return_if_fail (name != NULL); + parent_node = g_node_find (t->priv->toolbars, G_IN_ORDER, G_TRAVERSE_ALL, parent); if (sibling) { sibling_node = g_node_find (t->priv->toolbars, G_IN_ORDER, G_TRAVERSE_ALL, sibling); + g_return_if_fail (sibling_node != NULL); } add_action (t, parent_node, sibling_node, name); @@ -245,7 +260,10 @@ ephy_toolbars_group_add_toolbar (EphyToolbarsGroup *t) { GNode *node; + g_return_val_if_fail (IS_EPHY_TOOLBARS_GROUP (t), NULL); + node = add_toolbar (t); + g_return_val_if_fail (node != NULL, NULL); toolbars_group_save (t); @@ -280,6 +298,8 @@ load_defaults (EphyToolbarsGroup *t) xmlNodePtr root; const char *xml_filepath; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t)); + LOG ("Load default toolbar info") xml_filepath = t->priv->defaults; @@ -314,6 +334,8 @@ load_toolbar (EphyToolbarsGroup *t) xmlNodePtr root; const char *xml_filepath = t->priv->user; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t)); + LOG ("Load custom toolbar") if (!g_file_test (xml_filepath, G_FILE_TEST_EXISTS)) return; @@ -333,8 +355,12 @@ ephy_toolbars_group_to_string (EphyToolbarsGroup *t) char *result; int k = 0; + g_return_val_if_fail (IS_EPHY_TOOLBARS_GROUP (t), NULL); + tl = t->priv->toolbars; + g_return_val_if_fail (tl != NULL, NULL); + s = g_string_new (NULL); g_string_append (s, "<Root>"); for (l1 = tl->children; l1 != NULL; l1 = l1->next) @@ -455,7 +481,11 @@ ephy_toolbars_group_remove_toolbar (EphyToolbarsGroup *t, { GNode *node; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t)); + g_return_if_fail (toolbar != NULL); + node = g_node_find (t->priv->toolbars, G_IN_ORDER, G_TRAVERSE_ALL, toolbar); + g_return_if_fail (node != NULL); free_toolbar_node (node->data); g_node_destroy (node); @@ -470,7 +500,11 @@ ephy_toolbars_group_remove_item (EphyToolbarsGroup *t, { GNode *node; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (t)); + g_return_if_fail (item != NULL); + node = g_node_find (t->priv->toolbars, G_IN_ORDER, G_TRAVERSE_ALL, item); + g_return_if_fail (node != NULL); free_toolbar_node (node->data); g_node_destroy (node); @@ -484,6 +518,10 @@ ephy_toolbars_group_set_source (EphyToolbarsGroup *group, const char *defaults, const char *user) { + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (group)); + g_return_if_fail (defaults != NULL); + g_return_if_fail (user != NULL); + group->priv->defaults = g_strdup (defaults); group->priv->user = g_strdup (user); @@ -496,6 +534,9 @@ is_item_in_toolbars (EphyToolbarsGroup *group, const char *action) { GNode *l1, *l2; + g_return_val_if_fail (IS_EPHY_TOOLBARS_GROUP (group), FALSE); + g_return_val_if_fail (action != NULL, FALSE); + for (l1 = group->priv->toolbars->children; l1 != NULL; l1 = l1->next) { for (l2 = l1->children; l2 != NULL; l2 = l2->next) @@ -517,6 +558,8 @@ ephy_toolbars_group_foreach_available (EphyToolbarsGroup *group, { GNode *l1; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (group)); + for (l1 = group->priv->available_actions->children; l1 != NULL; l1 = l1->next) { EphyToolbarsItem *item; @@ -537,6 +580,8 @@ ephy_toolbars_group_foreach_toolbar (EphyToolbarsGroup *group, { GNode *l1; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (group)); + for (l1 = group->priv->toolbars->children; l1 != NULL; l1 = l1->next) { func (l1->data, data); @@ -550,6 +595,8 @@ ephy_toolbars_group_foreach_item (EphyToolbarsGroup *group, { GNode *l1, *l2; + g_return_if_fail (IS_EPHY_TOOLBARS_GROUP (group)); + for (l1 = group->priv->toolbars->children; l1 != NULL; l1 = l1->next) { for (l2 = l1->children; l2 != NULL; l2 = l2->next) @@ -567,7 +614,10 @@ ephy_toolbars_group_get_path (EphyToolbarsGroup *t, char *path = NULL; EphyToolbarsItem *titem; + 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; switch (g_node_depth (node)) @@ -591,4 +641,3 @@ ephy_toolbars_group_get_path (EphyToolbarsGroup *t, return path; } - |