[epiphany] uri-tester: clear HTTPS Everywhere context in dispose



commit 2ecb69ad74cb640a7ad04640f2b989f7b92ba8a2
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Dec 22 12:55:57 2016 -0600

    uri-tester: clear HTTPS Everywhere context in dispose
    
    It's a GObject, so we shouldn't be clearing it in finalize.

 embed/web-extension/ephy-uri-tester.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/embed/web-extension/ephy-uri-tester.c b/embed/web-extension/ephy-uri-tester.c
index 63d913f..5c8c0a3 100644
--- a/embed/web-extension/ephy-uri-tester.c
+++ b/embed/web-extension/ephy-uri-tester.c
@@ -606,7 +606,7 @@ ephy_uri_tester_rewrite_uri (EphyUriTester    *tester,
   }
 
 #ifdef HAVE_LIBHTTPSEVERYWHERE
-  if (flags & EPHY_URI_TEST_HTTPS_EVERYWHERE)
+  if ((flags & EPHY_URI_TEST_HTTPS_EVERYWHERE) && tester->https_everywhere_context != NULL)
     return https_everywhere_context_rewrite (tester->https_everywhere_context, request_uri);
 #endif
 
@@ -767,6 +767,20 @@ ephy_uri_tester_set_property (GObject      *object,
 }
 
 static void
+ephy_uri_tester_dispose (GObject *object)
+{
+  EphyUriTester *tester = EPHY_URI_TESTER (object);
+
+  LOG ("EphyUriTester disposing %p", object);
+
+#ifdef HAVE_LIBHTTPSEVERYWHERE
+  g_clear_object (&tester->https_everywhere_context);
+#endif
+
+  G_OBJECT_CLASS (ephy_uri_tester_parent_class)->dispose (object);
+}
+
+static void
 ephy_uri_tester_finalize (GObject *object)
 {
   EphyUriTester *tester = EPHY_URI_TESTER (object);
@@ -793,10 +807,6 @@ ephy_uri_tester_finalize (GObject *object)
   g_regex_unref (tester->regex_subdocument);
   g_regex_unref (tester->regex_frame_add);
 
-#ifdef HAVE_LIBHTTPSEVERYWHERE
-  g_clear_object (&tester->https_everywhere_context);
-#endif
-
   G_OBJECT_CLASS (ephy_uri_tester_parent_class)->finalize (object);
 }
 
@@ -806,6 +816,7 @@ ephy_uri_tester_class_init (EphyUriTesterClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->set_property = ephy_uri_tester_set_property;
+  object_class->dispose = ephy_uri_tester_dispose;
   object_class->finalize = ephy_uri_tester_finalize;
 
   obj_properties[PROP_ADBLOCK_DATA_DIR] =


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