[epiphany] uri-tester: Don't crash if UI process quits early



commit 6e99a3c35170353567dc4ab7ce652e34c7d1be98
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Oct 24 19:16:46 2016 -0500

    uri-tester: Don't crash if UI process quits early
    
    There's no reason to crash here if we happen to be disposed before HTTPS
    Everywhere context is initialized. This might not be so hard to trigger
    in practice, just Ctrl+Q after opening the browser.

 embed/ephy-uri-tester.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-uri-tester.c b/embed/ephy-uri-tester.c
index 6946617..b63dd1c 100644
--- a/embed/ephy-uri-tester.c
+++ b/embed/ephy-uri-tester.c
@@ -985,10 +985,12 @@ https_everywhere_context_init_cb (HTTPSEverywhereContext *context,
 
   https_everywhere_context_init_finish (context, res, &error);
 
-  /* Note that if this were not fatal, we would need some way to ensure that
-   * future pending requests would not get stuck forever. */
-  if (error)
-    g_error ("Failed to initialize HTTPS Everywhere context: %s", error->message);
+  /* Note that if this were not fatal, we would need some way to ensure
+   * that future pending requests would not get stuck forever. */
+  if (error) {
+    if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+      g_error ("Failed to initialize HTTPS Everywhere context: %s", error->message);
+  }
 
   g_list_foreach (tester->deferred_requests, (GFunc)handle_deferred_request, tester);
   g_list_free_full (tester->deferred_requests, (GDestroyNotify)deferred_request_free);


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