[epiphany/mcatanzaro/#1065: 3/3] view-source-handler: complete request at most once



commit 65a97fecee6a8db32316fe1bb3aa7faea4e5892a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Jan 22 15:17:04 2020 -0600

    view-source-handler: complete request at most once
    
    If we fail to disconnect the signal after the page loads, it could start
    another load on its own using JS, which would be a disaster because we
    already freed the EphyViewSourceRequest after the first load.
    
    Hopefully fixes #1065

 embed/ephy-view-source-handler.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/embed/ephy-view-source-handler.c b/embed/ephy-view-source-handler.c
index f0ff4d23a..43fb9be17 100644
--- a/embed/ephy-view-source-handler.c
+++ b/embed/ephy-view-source-handler.c
@@ -155,8 +155,12 @@ load_changed_cb (WebKitWebView         *web_view,
                  WebKitLoadEvent        load_event,
                  EphyViewSourceRequest *request)
 {
-  if (load_event == WEBKIT_LOAD_FINISHED)
+  if (load_event == WEBKIT_LOAD_FINISHED) {
+    g_signal_handler_disconnect (request->web_view, request->load_changed_id);
+    request->load_changed_id = 0;
+
     ephy_view_source_request_begin_get_source_from_web_view (request, web_view);
+  }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]