diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-03-03 13:13:25 +0100 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-03-03 13:17:04 +0100 |
commit | 0e41733f4c1ee10bdd972a848f00ac5a85b31d55 (patch) | |
tree | 1c9f37009a4fe2d94a0ebb1638537ae68b41ee8d | |
parent | 2fa597e259e6aa01b7c3c10bb1fc7a9835bd833c (diff) | |
download | nautilus-0e41733f4c1ee10bdd972a848f00ac5a85b31d55.tar.gz |
notebook: avoid updating if no children
We were having a critical when a tab was searching and we closed the
window due to the view reporting it's not loading anymore when the
notebook already removed the slot.
This is due to the slot working independently to the notebook, and the
view reporting to stop loading on dispose, which is fine since the view
needs to report its new status to the window as well. However the window
also update the notebook when is the notebook that removes the slot
and therefore dispose the view.
To avoid that, check on the window if the notebook still contains
the slot or not, and update only in that case.
-rw-r--r-- | src/nautilus-notebook.c | 18 | ||||
-rw-r--r-- | src/nautilus-notebook.h | 2 | ||||
-rw-r--r-- | src/nautilus-window.c | 5 |
3 files changed, 24 insertions, 1 deletions
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c index b04254c48..db311242d 100644 --- a/src/nautilus-notebook.c +++ b/src/nautilus-notebook.c @@ -188,6 +188,24 @@ nautilus_notebook_init (NautilusNotebook *notebook) #endif } +gboolean +nautilus_notebook_contains_slot (NautilusNotebook *notebook, + NautilusWindowSlot *slot) +{ + GList *children; + GList *l; + gboolean found = FALSE; + + children = gtk_container_get_children (GTK_CONTAINER (notebook)); + for (l = children; l != NULL && !found; l = l->next) { + found = l->data == slot; + } + + g_list_free (children); + + return found; +} + void nautilus_notebook_sync_loading (NautilusNotebook *notebook, NautilusWindowSlot *slot) diff --git a/src/nautilus-notebook.h b/src/nautilus-notebook.h index eade6f298..d81068657 100644 --- a/src/nautilus-notebook.h +++ b/src/nautilus-notebook.h @@ -79,6 +79,8 @@ gboolean nautilus_notebook_can_reorder_current_child_relative (NautilusNo void nautilus_notebook_prev_page (NautilusNotebook *notebook); void nautilus_notebook_next_page (NautilusNotebook *notebook); +gboolean nautilus_notebook_contains_slot (NautilusNotebook *notebook, + NautilusWindowSlot *slot); G_END_DECLS diff --git a/src/nautilus-window.c b/src/nautilus-window.c index e1753f614..4c9170953 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -795,7 +795,10 @@ nautilus_window_sync_allow_stop (NautilusWindow *window, update_cursor (window); } - nautilus_notebook_sync_loading (NAUTILUS_NOTEBOOK (window->priv->notebook), slot); + /* Avoid updating the notebook if we are calling on dispose or + * on removal of a notebook tab */ + if (nautilus_notebook_contains_slot (NAUTILUS_NOTEBOOK (window->priv->notebook), slot)) + nautilus_notebook_sync_loading (NAUTILUS_NOTEBOOK (window->priv->notebook), slot); } } |