Bug 1531300 - Handle multiple moz_container_unmap_wayland()/moz_container_map_wayland() r=stransky
authorsotaro <sotaro.ikeda.g@gmail.com>
Thu, 28 Feb 2019 13:33:02 +0000
changeset 519631 f3e12516497881bcc7589ec99ce71426ff6de214
parent 519613 db533ea3d56186d28d701cfa957ba95f5d3421e0
child 519632 673976e3f52e343996b2d4da4e2988bb2f6c5e82
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1531300, 1527804
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531300 - Handle multiple moz_container_unmap_wayland()/moz_container_map_wayland() r=stransky Bug 1527804 did not expect multiple moz_container_unmap_wayland()/moz_container_map_wayland() calls. inital_draw_cb should not be cleared in multiple moz_container_unmap_wayland(). Differential Revision: https://phabricator.services.mozilla.com/D21522
gfx/webrender_bindings/RenderCompositorEGL.cpp
widget/gtk/mozcontainer.cpp
--- a/gfx/webrender_bindings/RenderCompositorEGL.cpp
+++ b/gfx/webrender_bindings/RenderCompositorEGL.cpp
@@ -75,16 +75,18 @@ RenderCompositorEGL::RenderCompositorEGL
   MOZ_ASSERT(mGL);
 }
 
 RenderCompositorEGL::~RenderCompositorEGL() { DestroyEGLSurface(); }
 
 bool RenderCompositorEGL::BeginFrame() {
   if (mWidget->AsX11() &&
       mWidget->AsX11()->WaylandRequestsUpdatingEGLSurface()) {
+    // Destroy EGLSurface if it exists.
+    DestroyEGLSurface();
     mEGLSurface = CreateEGLSurface(mWidget);
     gl::GLContextEGL::Cast(gl())->SetEGLSurfaceOverride(mEGLSurface);
   }
 
   if (!mGL->MakeCurrent()) {
     gfxCriticalNote << "Failed to make render context current, can't draw.";
     return false;
   }
--- a/widget/gtk/mozcontainer.cpp
+++ b/widget/gtk/mozcontainer.cpp
@@ -216,17 +216,16 @@ static gboolean moz_container_map_waylan
 static void moz_container_unmap_wayland(MozContainer *container) {
   g_clear_pointer(&container->eglwindow, wl_egl_window_destroy);
   g_clear_pointer(&container->subsurface, wl_subsurface_destroy);
   g_clear_pointer(&container->surface, wl_surface_destroy);
   g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy);
 
   container->surface_needs_clear = true;
   container->ready_to_draw = false;
-  container->inital_draw_cb = nullptr;
 }
 
 static gint moz_container_get_scale(MozContainer *container) {
   static auto sGdkWindowGetScaleFactorPtr =
       (gint(*)(GdkWindow *))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor");
 
   if (sGdkWindowGetScaleFactorPtr) {
     GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(container));