Blob Blame History Raw
From 18d0bcf0c29167f4f02b1ad8d474568069912353 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Sat, 21 Feb 2015 10:19:24 -0600
Subject: [PATCH] Fix UI process crash if the web process crashes on start

Currently there is a WebKit bug that causes the web process to crash
when we use webkit_web_view_load_alternate_html() on a local page, say
because Epiphany was closed when a file:// URI was opened in an embed
other than the focused embed. That crash occurs after
web_extension_appeared_cb() but prior to
web_extension_proxy_created_cb(), triggering a call to
web_extension_vanished_cb(), which deletes the EphyWebExtensionProxy
object that is expected to still be alive when
web_extension_proxy_created_cb() is called, crashing the UI process.
We can fix this with a ref/unref pair.

https://bugzilla.gnome.org/show_bug.cgi?id=744896
---
 embed/ephy-web-extension-proxy.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/embed/ephy-web-extension-proxy.c b/embed/ephy-web-extension-proxy.c
index 773e0f9..2e03996 100644
--- a/embed/ephy-web-extension-proxy.c
+++ b/embed/ephy-web-extension-proxy.c
@@ -90,6 +90,8 @@ web_extension_proxy_created_cb (GDBusProxy *proxy,
     g_warning ("Error creating web extension proxy: %s\n", error->message);
     g_error_free (error);
   }
+
+  g_object_unref (web_extension);
 }
 
 static void
@@ -110,7 +112,9 @@ web_extension_appeared_cb (GDBusConnection *connection,
                     EPHY_WEB_EXTENSION_INTERFACE,
                     web_extension->priv->cancellable,
                     (GAsyncReadyCallback)web_extension_proxy_created_cb,
-                    web_extension);
+                    /* Ref here because the web process could crash, triggering
+                     * web_extension_vanished_cb() before this finishes. */
+                    g_object_ref (web_extension));
 }
 
 static void
-- 
2.1.0