From abe1a40d562514cfe6b3c8dae1397d511062ddab Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 2 Oct 2005 18:50:51 +0000 Subject: Use nsIDOMWindowInternal::Close to close tabs. Delay tabs destruction to 2005-10-02 Christian Persch * configure.ac: * embed/ephy-embed-shell.c: (ephy_embed_shell_dispose), (ephy_embed_shell_finalize), (ephy_embed_shell_class_init): * embed/ephy-embed.c: (ephy_embed_base_init), (ephy_embed_show_page_certificate), (ephy_embed_close): * embed/ephy-embed.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/mozilla-embed.cpp: * src/ephy-notebook.c: (ephy_notebook_class_init), (close_button_clicked_cb): * src/ephy-notebook.h: * src/ephy-python.c: (ephy_python_init), (ephy_python_shutdown), (ephy_python_schedule_gc): * src/ephy-shell.c: (ephy_shell_class_init), (gnome_session_init), (ephy_shell_dispose), (ephy_shell_finalize): * src/ephy-tab.c: (ephy_tab_init): * src/ephy-window.c: (construct_confirm_close_dialog), (confirm_close_with_modified_forms), (embed_modal_alert_cb), (idle_tab_remove_cb), (schedule_tab_close), (embed_close_request_cb), (embed_destroy_browser_cb), (tab_added_cb), (tab_removed_cb), (tab_close_request_cb), (setup_notebook), (remove_true), (ephy_window_dispose), (cancel_handler), (ephy_window_init), (ephy_window_finalize): * src/window-commands.c: (event_with_shift), (window_cmd_view_reload), (window_cmd_file_close_window): Use nsIDOMWindowInternal::Close to close tabs. Delay tabs destruction to an idle handler, to avoid crashes when tabs are closed from signal handlers (blur, mousedown, keydown etc). Fixes bug #172878, bug #172879, bug #172882, bug #303254, bug #313425. --- embed/ephy-embed-shell.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'embed/ephy-embed-shell.c') diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index 43e7fb692..fb7a7d216 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -87,40 +87,49 @@ ephy_embed_shell_get_type (void) } static void -ephy_embed_shell_finalize (GObject *object) +ephy_embed_shell_dispose (GObject *object) { EphyEmbedShell *shell = EPHY_EMBED_SHELL (object); - LOG ("Unref history"); - if (shell->priv->global_history) - { - g_object_unref (shell->priv->global_history); - } - - LOG ("Unref downloader"); if (shell->priv->downloader_view) { + LOG ("Unref downloader"); g_object_remove_weak_pointer (G_OBJECT(shell->priv->downloader_view), (gpointer *) &shell->priv->downloader_view); g_object_unref (shell->priv->downloader_view); } - LOG ("Unref favicon cache"); if (shell->priv->favicon_cache) { + LOG ("Unref favicon cache"); g_object_unref (G_OBJECT (shell->priv->favicon_cache)); } - LOG ("Unref encodings"); if (shell->priv->encodings) + LOG ("Unref encodings"); { + LOG ("Unref encodings"); g_object_unref (G_OBJECT (shell->priv->encodings)); } - LOG ("Unref embed single"); + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +ephy_embed_shell_finalize (GObject *object) +{ + EphyEmbedShell *shell = EPHY_EMBED_SHELL (object); + + if (shell->priv->global_history) + { + LOG ("Unref history"); + g_object_unref (shell->priv->global_history); + } + if (shell->priv->embed_single) { + LOG ("Unref embed single"); g_object_unref (G_OBJECT (shell->priv->embed_single)); } @@ -235,6 +244,7 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass) parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + object_class->dispose = ephy_embed_shell_dispose; object_class->finalize = ephy_embed_shell_finalize; klass->get_embed_single = impl_get_embed_single; -- cgit v1.2.3