<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192510] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192510">192510</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-17 00:37:21 -0800 (Tue, 17 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Web Process crashes on reparenting a WebView with AC mode on
https://bugs.webkit.org/show_bug.cgi?id=151139

Reviewed by Mario Sanchez Prada.

When the web view is reparented, the widget is first unrealized,
and then realized again when added to the new parent. In the
second realize, the old redirected XComposite window is destroyed
and a new one is created, but the web process is still using the
old redirected window ID. As soon as the redirected window is
destroyed and the web process tries to use the window ID, it
crashes due to a BadDrawable X error. We have to notify the web
process as soon as the web view is unrealized to stop using the
current window ID and exit accelerated compositing mode until a
new window ID is given. This notification needs to be synchronous,
because the window can be destroyed in the UI process before the
message is received in the web process.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseRealize): Add an assert to ensure we never have
a redirected window when the view is realized. Also check drawing
area is not nullptr, since it can be destroyed at any time if the
web process crashes.
(webkitWebViewBaseUnrealize): Call
DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing()
and destroy the redirected XComposite window.
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing):
Send DestroyNativeSurfaceHandleForCompositing synchronous messsage
to the web process.
* UIProcess/DrawingAreaProxyImpl.h:
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/DrawingArea.messages.in: Add
DestroyNativeSurfaceHandleForCompositing message.
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::destroyNativeSurfaceHandleForCompositing):
Set the native surface handler for compositing to 0 to reset it.
* WebProcess/WebPage/DrawingAreaImpl.h:
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::makeContextCurrent): Return false
early always when layer tree context ID is 0, even if we already
have a context.
(WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing):
Cancel any pending layer flush when setting a new handler.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDrawingAreaProxyImplcpp">trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDrawingAreaProxyImplh">trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreamessagesin">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreaImplcpp">trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreaImplh">trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagegtkLayerTreeHostGtkcpp">trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2015-11-17  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Web Process crashes on reparenting a WebView with AC mode on
+        https://bugs.webkit.org/show_bug.cgi?id=151139
+
+        Reviewed by Mario Sanchez Prada.
+
+        When the web view is reparented, the widget is first unrealized,
+        and then realized again when added to the new parent. In the
+        second realize, the old redirected XComposite window is destroyed
+        and a new one is created, but the web process is still using the
+        old redirected window ID. As soon as the redirected window is
+        destroyed and the web process tries to use the window ID, it
+        crashes due to a BadDrawable X error. We have to notify the web
+        process as soon as the web view is unrealized to stop using the
+        current window ID and exit accelerated compositing mode until a
+        new window ID is given. This notification needs to be synchronous,
+        because the window can be destroyed in the UI process before the
+        message is received in the web process.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseRealize): Add an assert to ensure we never have
+        a redirected window when the view is realized. Also check drawing
+        area is not nullptr, since it can be destroyed at any time if the
+        web process crashes.
+        (webkitWebViewBaseUnrealize): Call
+        DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing()
+        and destroy the redirected XComposite window.
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing):
+        Send DestroyNativeSurfaceHandleForCompositing synchronous messsage
+        to the web process.
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/DrawingArea.messages.in: Add
+        DestroyNativeSurfaceHandleForCompositing message.
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::destroyNativeSurfaceHandleForCompositing):
+        Set the native surface handler for compositing to 0 to reset it.
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
+        (WebKit::LayerTreeHostGtk::makeContextCurrent): Return false
+        early always when layer tree context ID is 0, even if we already
+        have a context.
+        (WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing):
+        Cancel any pending layer flush when setting a new handler.
+
</ins><span class="cx"> 2015-11-16  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix CMake build and make PluginProcess executable
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -280,6 +280,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><span class="cx">     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
</span><ins>+        ASSERT(!priv-&gt;redirectedWindow);
</ins><span class="cx">         priv-&gt;redirectedWindow = RedirectedXCompositeWindow::create(
</span><span class="cx">             gtk_widget_get_parent_window(widget),
</span><span class="cx">             [webView] {
</span><span class="lines">@@ -288,8 +289,8 @@
</span><span class="cx">                     gtk_widget_queue_draw(GTK_WIDGET(webView));
</span><span class="cx">             });
</span><span class="cx">         if (priv-&gt;redirectedWindow) {
</span><del>-            DrawingAreaProxyImpl* drawingArea = static_cast&lt;DrawingAreaProxyImpl*&gt;(priv-&gt;pageProxy-&gt;drawingArea());
-            drawingArea-&gt;setNativeSurfaceHandleForCompositing(priv-&gt;redirectedWindow-&gt;windowID());
</del><ins>+            if (DrawingAreaProxyImpl* drawingArea = static_cast&lt;DrawingAreaProxyImpl*&gt;(priv-&gt;pageProxy-&gt;drawingArea()))
+                drawingArea-&gt;setNativeSurfaceHandleForCompositing(priv-&gt;redirectedWindow-&gt;windowID());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -329,8 +330,8 @@
</span><span class="cx">     gdk_window_set_user_data(window, widget);
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(X11) &amp;&amp; !USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><del>-    DrawingAreaProxyImpl* drawingArea = static_cast&lt;DrawingAreaProxyImpl*&gt;(priv-&gt;pageProxy-&gt;drawingArea());
-    drawingArea-&gt;setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(window));
</del><ins>+    if (DrawingAreaProxyImpl* drawingArea = static_cast&lt;DrawingAreaProxyImpl*&gt;(priv-&gt;pageProxy-&gt;drawingArea()))
+        drawingArea-&gt;setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(window));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
</span><span class="lines">@@ -345,6 +346,13 @@
</span><span class="cx"> static void webkitWebViewBaseUnrealize(GtkWidget* widget)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(widget);
</span><ins>+#if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(X11)
+    if (DrawingAreaProxyImpl* drawingArea = static_cast&lt;DrawingAreaProxyImpl*&gt;(webView-&gt;priv-&gt;pageProxy-&gt;drawingArea()))
+        drawingArea-&gt;destroyNativeSurfaceHandleForCompositing();
+#endif
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
+    webView-&gt;priv-&gt;redirectedWindow = nullptr;
+#endif
</ins><span class="cx">     gtk_im_context_set_client_window(webView-&gt;priv-&gt;inputMethodFilter.context(), nullptr);
</span><span class="cx"> 
</span><span class="cx">     GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)-&gt;unrealize(widget);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDrawingAreaProxyImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -314,6 +314,12 @@
</span><span class="cx"> {
</span><span class="cx">     m_webPageProxy.process().send(Messages::DrawingArea::SetNativeSurfaceHandleForCompositing(handle), m_webPageProxy.pageID());
</span><span class="cx"> }
</span><ins>+
+void DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing()
+{
+    bool handled;
+    m_webPageProxy.process().sendSync(Messages::DrawingArea::DestroyNativeSurfaceHandleForCompositing(), Messages::DrawingArea::DestroyNativeSurfaceHandleForCompositing::Reply(handled), m_webPageProxy.pageID());
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDrawingAreaProxyImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
</span><span class="cx">     void setNativeSurfaceHandleForCompositing(uint64_t);
</span><ins>+    void destroyNativeSurfaceHandleForCompositing();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -150,6 +150,7 @@
</span><span class="cx"> private:
</span><span class="cx">     // IPC::MessageReceiver.
</span><span class="cx">     virtual void didReceiveMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
</span><ins>+    virtual void didReceiveSyncMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp;) override;
</ins><span class="cx"> 
</span><span class="cx">     // Message handlers.
</span><span class="cx">     // FIXME: These should be pure virtual.
</span><span class="lines">@@ -170,6 +171,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
</span><span class="cx">     virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
</span><ins>+    virtual void destroyNativeSurfaceHandleForCompositing(bool&amp;) = 0;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreamessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -42,5 +42,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
</span><span class="cx">     SetNativeSurfaceHandleForCompositing(uint64_t handle)
</span><ins>+    DestroyNativeSurfaceHandleForCompositing() -&gt; (bool handled)
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreaImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -699,6 +699,12 @@
</span><span class="cx">         m_layerTreeHost-&gt;setNativeSurfaceHandleForCompositing(handle);
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
+void DrawingAreaImpl::destroyNativeSurfaceHandleForCompositing(bool&amp; handled)
+{
+    handled = true;
+    setNativeSurfaceHandleForCompositing(0);
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreaImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
</span><span class="cx">     virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
</span><ins>+    virtual void destroyNativeSurfaceHandleForCompositing(bool&amp;) override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagegtkLayerTreeHostGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (192509 => 192510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp        2015-11-17 08:11:37 UTC (rev 192509)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp        2015-11-17 08:37:21 UTC (rev 192510)
</span><span class="lines">@@ -145,10 +145,12 @@
</span><span class="cx"> 
</span><span class="cx"> bool LayerTreeHostGtk::makeContextCurrent()
</span><span class="cx"> {
</span><ins>+    if (!m_layerTreeContext.contextID) {
+        m_context = nullptr;
+        return false;
+    }
+
</ins><span class="cx">     if (!m_context) {
</span><del>-        if (!m_layerTreeContext.contextID)
-            return false;
-
</del><span class="cx">         m_context = GLContext::createContextForWindow(reinterpret_cast&lt;GLNativeWindowType&gt;(m_layerTreeContext.contextID), GLContext::sharingContext());
</span><span class="cx">         if (!m_context)
</span><span class="cx">             return false;
</span><span class="lines">@@ -416,6 +418,7 @@
</span><span class="cx"> 
</span><span class="cx"> void LayerTreeHostGtk::setNativeSurfaceHandleForCompositing(uint64_t handle)
</span><span class="cx"> {
</span><ins>+    cancelPendingLayerFlush();
</ins><span class="cx">     m_layerTreeContext.contextID = handle;
</span><span class="cx"> 
</span><span class="cx">     // The creation of the TextureMapper needs an active OpenGL context.
</span></span></pre>
</div>
</div>

</body>
</html>