Title: [196916] releases/WebKitGTK/webkit-2.10/Source/WebKit2
Revision
196916
Author
[email protected]
Date
2016-02-22 01:29:39 -0800 (Mon, 22 Feb 2016)

Log Message

Merge r196257 - [GTK] Fix crash when creating webview with g_object_new
https://bugs.webkit.org/show_bug.cgi?id=153989

Patch by Danilo Cesar Lemes de Paula <[email protected]> on 2016-02-08
Reviewed by Carlos Garcia Campos.

g_object_new(WEBKIT_TYPE_WEB_VIEW, NULL) crashes webkit
as _WebKitWebViewBasePrivate constructor requires a mainloop, but
webkit is only initialized when a context is created (which
doesn't happen with a direct call to g_object_new).

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkit_web_view_base_class_init):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog (196915 => 196916)


--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog	2016-02-22 09:25:44 UTC (rev 196915)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog	2016-02-22 09:29:39 UTC (rev 196916)
@@ -1,3 +1,18 @@
+2016-02-08  Danilo Cesar Lemes de Paula  <[email protected]>
+
+        [GTK] Fix crash when creating webview with g_object_new
+        https://bugs.webkit.org/show_bug.cgi?id=153989
+
+        Reviewed by Carlos Garcia Campos.
+
+        g_object_new(WEBKIT_TYPE_WEB_VIEW, NULL) crashes webkit
+        as _WebKitWebViewBasePrivate constructor requires a mainloop, but
+        webkit is only initialized when a context is created (which
+        doesn't happen with a direct call to g_object_new).
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkit_web_view_base_class_init):
+
 2016-02-08  Carlos Garcia Campos  <[email protected]>
 
         [GTK] WebKitWebView should send crossing events to the WebProcess

Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (196915 => 196916)


--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2016-02-22 09:25:44 UTC (rev 196915)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2016-02-22 09:29:39 UTC (rev 196916)
@@ -42,6 +42,7 @@
 #include "WebEventFactory.h"
 #include "WebFullScreenClientGtk.h"
 #include "WebInspectorProxy.h"
+#include "WebKit2Initialize.h"
 #include "WebKitAuthenticationDialog.h"
 #include "WebKitPrivate.h"
 #include "WebKitWebViewBaseAccessible.h"
@@ -1100,6 +1101,11 @@
     containerClass->add = webkitWebViewBaseContainerAdd;
     containerClass->remove = webkitWebViewBaseContainerRemove;
     containerClass->forall = webkitWebViewBaseContainerForall;
+
+    // Before creating a WebKitWebViewBasePriv we need to be sure that WebKit is started.
+    // Usually starting a context triggers InitializeWebKit2, but in case
+    // we create a view without asking before for a default_context we get a crash.
+    WebKit::InitializeWebKit2();
 }
 
 WebKitWebViewBase* webkitWebViewBaseCreate(WebProcessPool* context, WebPreferences* preferences, WebPageGroup* pageGroup, WebUserContentControllerProxy* userContentController, WebPageProxy* relatedPage)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to