From 6e1e6675b4ea682640020c2615d59a07e4a6d408 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Tue, 19 Mar 2013 10:30:58 +0100 Subject: ephy-web-view: disconnect form auth signal handler or dispose The signal can (somewhat easily) be emitted on the shell after the web view dies. --- embed/ephy-web-view.c | 92 ++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 45 deletions(-) (limited to 'embed') diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 439d83347..5692d0338 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1033,6 +1033,51 @@ icon_loaded_cb (EphyWebView *view, } #endif +#ifdef HAVE_WEBKIT2 +static void +form_auth_data_save_confirmation_response (GtkInfoBar *info_bar, + gint response_id, + gpointer user_data) +{ + GDBusProxy *web_extension; + guint request_id = GPOINTER_TO_INT (user_data); + + gtk_widget_destroy (GTK_WIDGET (info_bar)); + + web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ()); + if (!web_extension) + return; + + g_dbus_proxy_call (web_extension, + "FormAuthDataSaveConfirmationResponse", + g_variant_new ("(ub)", request_id, response_id == GTK_RESPONSE_YES), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); +} + +static void +form_auth_data_save_requested (EphyEmbedShell *shell, + guint request_id, + guint64 page_id, + const char *hostname, + const char *username, + WebKitWebView *web_view) +{ + GtkWidget *info_bar; + + if (webkit_web_view_get_page_id (web_view) != page_id) + return; + + info_bar = ephy_web_view_create_form_auth_save_confirmation_info_bar (EPHY_WEB_VIEW (web_view), + hostname, username); + g_signal_connect (info_bar, "response", + G_CALLBACK (form_auth_data_save_confirmation_response), + GINT_TO_POINTER (request_id)); + + gtk_widget_show (info_bar); +} +#endif + static void ephy_web_view_finalize (GObject *object) { @@ -1044,6 +1089,8 @@ ephy_web_view_finalize (GObject *object) #ifdef HAVE_WEBKIT2 g_signal_handlers_disconnect_by_func (object, icon_changed_cb, NULL); + + g_signal_handlers_disconnect_by_func (ephy_embed_shell_get_default (), form_auth_data_save_requested, object); #endif if (priv->non_search_regex) { @@ -2603,51 +2650,6 @@ zoom_changed_cb (WebKitWebView *web_view, } } -#ifdef HAVE_WEBKIT2 -static void -form_auth_data_save_confirmation_response (GtkInfoBar *info_bar, - gint response_id, - gpointer user_data) -{ - GDBusProxy *web_extension; - guint request_id = GPOINTER_TO_INT (user_data); - - gtk_widget_destroy (GTK_WIDGET (info_bar)); - - web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ()); - if (!web_extension) - return; - - g_dbus_proxy_call (web_extension, - "FormAuthDataSaveConfirmationResponse", - g_variant_new ("(ub)", request_id, response_id == GTK_RESPONSE_YES), - G_DBUS_CALL_FLAGS_NONE, - -1, NULL, NULL, NULL); -} - -static void -form_auth_data_save_requested (EphyEmbedShell *shell, - guint request_id, - guint64 page_id, - const char *hostname, - const char *username, - WebKitWebView *web_view) -{ - GtkWidget *info_bar; - - if (webkit_web_view_get_page_id (web_view) != page_id) - return; - - info_bar = ephy_web_view_create_form_auth_save_confirmation_info_bar (EPHY_WEB_VIEW (web_view), - hostname, username); - g_signal_connect (info_bar, "response", - G_CALLBACK (form_auth_data_save_confirmation_response), - GINT_TO_POINTER (request_id)); - - gtk_widget_show (info_bar); -} -#endif - #ifndef HAVE_WEBKIT2 static void add_do_not_track_header_cb (WebKitWebView *view, WebKitWebFrame *frame, -- cgit v1.2.3