diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-05-26 03:39:09 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-05-26 03:39:09 +0800 |
commit | 9ae7960ca8c3ca534ba07bb6d58b430ee9cda413 (patch) | |
tree | 552cf6c6fded80d05acaea44eeef46f7509d21ad /lib/ephy-node.c | |
parent | c159006b08ac492649715c9a3ce55f258e199f97 (diff) | |
download | gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.tar gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.tar.gz gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.tar.bz2 gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.tar.lz gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.tar.xz gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.tar.zst gsoc2013-epiphany-9ae7960ca8c3ca534ba07bb6d58b430ee9cda413.zip |
Try to fix node removal problems. I cant repro crashes ... but they are
2003-05-25 Marco Pesenti Gritti <marco@it.gnome.org>
* configure.in:
* embed/ephy-favicon-cache.c: (ephy_favicon_cache_save):
* embed/ephy-history.c: (ephy_history_save), (hosts_removed_cb),
(pages_removed_cb), (unref_empty_host),
(page_removed_from_host_cb), (connect_page_removed_from_host),
(ephy_history_init), (ephy_history_add_host):
* lib/ephy-file-helpers.c: (ephy_file_save_xml):
* lib/ephy-file-helpers.h:
* lib/ephy-node.c: (callback), (ephy_node_emit_signal),
(real_remove_child), (ephy_node_dispose):
* lib/ephy-node.h:
* lib/ephy-state.c: (ephy_states_save):
* lib/widgets/ephy-tree-model-node.c: (root_child_removed_cb):
* src/bookmarks/ephy-bookmarks-export.c:
(ephy_bookmarks_export_rdf):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
(bookmarks_removed_cb), (topics_removed_cb):
Try to fix node removal problems. I cant repro crashes ...
but they are quite hard to reproduce.
Use a save_xml helper that is low disk safe.
* src/ephy-automation.c: (impl_ephy_automation_loadurl):
Use OPEN_PAGE when an url is passed
Diffstat (limited to 'lib/ephy-node.c')
-rw-r--r-- | lib/ephy-node.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/lib/ephy-node.c b/lib/ephy-node.c index 660b234ee..35c7f87d6 100644 --- a/lib/ephy-node.c +++ b/lib/ephy-node.c @@ -129,10 +129,21 @@ callback (long id, EphyNodeSignalData *data, gpointer *user_data) case EPHY_NODE_CHILD_ADDED: case EPHY_NODE_CHILD_CHANGED: - case EPHY_NODE_CHILD_REMOVED: data->callback (data->node, va_arg (valist, EphyNode *), data->data); break; + case EPHY_NODE_CHILD_REMOVED: + { + EphyNode *node; + guint last_index; + + node = va_arg (valist, EphyNode *); + last_index = va_arg (valist, guint); + + data->callback (data->node, node, last_index, data->data); + } + break; + case EPHY_NODE_CHILDREN_REORDERED: data->callback (data->node, va_arg (valist, int *), data->data); break; @@ -152,6 +163,7 @@ ephy_node_emit_signal (EphyNode *node, EphyNodeSignalType type, ...) g_hash_table_foreach (node->signals, (GHFunc) callback, data); + va_end (valist); } @@ -197,6 +209,9 @@ real_remove_child (EphyNode *node, if (remove_from_parent) { guint i; + guint old_index; + + old_index = node_info->index; g_ptr_array_remove_index (node->children, node_info->index); @@ -216,21 +231,20 @@ real_remove_child (EphyNode *node, g_static_rw_lock_writer_unlock (borked_node->lock); } + + write_lock_to_read_lock (node); + write_lock_to_read_lock (child); + + ephy_node_emit_signal (node, EPHY_NODE_CHILD_REMOVED, child, old_index); + + read_lock_to_write_lock (node); + read_lock_to_write_lock (child); } if (remove_from_child) { g_hash_table_remove (child->parents, GINT_TO_POINTER (node->id)); } - - write_lock_to_read_lock (node); - write_lock_to_read_lock (child); - - ephy_node_emit_signal (node, EPHY_NODE_CHILD_REMOVED, child); - - read_lock_to_write_lock (node); - read_lock_to_write_lock (child); - } static void @@ -267,19 +281,8 @@ ephy_node_dispose (EphyNode *node) { guint i; - _ephy_node_db_remove_id (node->db, node->id); - lock_gdk (); - /* remove from DAG */ - g_hash_table_foreach (node->parents, - (GHFunc) remove_child, - node); - - g_hash_table_foreach (node->signals, - (GHFunc) unref_signal_objects, - node); - for (i = 0; i < node->children->len; i++) { EphyNode *child; @@ -292,10 +295,21 @@ ephy_node_dispose (EphyNode *node) g_static_rw_lock_writer_unlock (child->lock); } + /* remove from DAG */ + g_hash_table_foreach (node->parents, + (GHFunc) remove_child, + node); + g_static_rw_lock_writer_unlock (node->lock); ephy_node_emit_signal (node, EPHY_NODE_DESTROYED); + g_hash_table_foreach (node->signals, + (GHFunc) unref_signal_objects, + node); + + _ephy_node_db_remove_id (node->db, node->id); + unlock_gdk (); } |