From 89fcedf92ddb52ac1cba8007d4b06b4fe2f92a31 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 30 May 2019 11:33:29 +0000 Subject: [PATCH] Bug 1555653 Fix asserts in WindowBackBufferShm; r=stransky Differential Revision: https://phabricator.services.mozilla.com/D33147 --HG-- extra : moz-landing-system : lando --- widget/gtk/WindowSurfaceWayland.cpp | 4 +--- widget/gtk/WindowSurfaceWayland.h | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp index 6067d65cd8e2..195eb810202b 100644 --- a/widget/gtk/WindowSurfaceWayland.cpp +++ b/widget/gtk/WindowSurfaceWayland.cpp @@ -409,6 +409,7 @@ already_AddRefed WindowBackBufferShm::Lock() { mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); gfx::IntSize lockSize(mWidth, mHeight); + mIsLocked = true; return gfxPlatform::CreateDrawTargetForData( static_cast(mShmPool.GetImageData()), lockSize, BUFFER_BPP * mWidth, GetSurfaceFormat()); @@ -593,9 +594,6 @@ WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( return mWaylandBuffer; } - MOZ_ASSERT(!mPendingCommit, - "Uncommitted buffer switch, screen artifacts ahead."); - // Front buffer is used by compositor, select a back buffer int availableBuffer; for (availableBuffer = 0; availableBuffer < BACK_BUFFER_NUM; diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h index e565dc0c1858..ac5212525b4e 100644 --- a/widget/gtk/WindowSurfaceWayland.h +++ b/widget/gtk/WindowSurfaceWayland.h @@ -44,8 +44,8 @@ class WaylandShmPool { class WindowBackBuffer { public: virtual already_AddRefed Lock() = 0; - virtual void Unlock(){}; - virtual bool IsLocked() { return false; }; + virtual void Unlock() = 0; + virtual bool IsLocked() = 0; void Attach(wl_surface* aSurface); virtual void Detach(wl_buffer* aBuffer) = 0; @@ -89,9 +89,12 @@ class WindowBackBufferShm : public WindowBackBuffer { ~WindowBackBufferShm(); already_AddRefed Lock(); + bool IsLocked() { return mIsLocked; }; + void Unlock() { mIsLocked = false; }; void Detach(wl_buffer* aBuffer); bool IsAttached() { return mAttached; } + void SetAttached() { mAttached = true; }; void Clear(); bool Resize(int aWidth, int aHeight); @@ -101,7 +104,6 @@ class WindowBackBufferShm : public WindowBackBuffer { int GetHeight() { return mHeight; }; wl_buffer* GetWlBuffer() { return mWaylandBuffer; }; - void SetAttached() { mAttached = true; }; private: void Create(int aWidth, int aHeight); @@ -116,6 +118,7 @@ class WindowBackBufferShm : public WindowBackBuffer { int mWidth; int mHeight; bool mAttached; + bool mIsLocked; }; #ifdef HAVE_LIBDRM