From 2e1880b85a02c716f4b1714fc800404c74b0b56b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 29 Mar 2019 18:43:43 +0100 Subject: [PATCH] Fix crash when using kwin on windowed mode Summary: Used to get: `kwin_wayland: kwin/composite.cpp:646: void KWin::Compositor::aboutToSwapBuffers(): Assertion "!m_bufferSwapPending' failed."` Test Plan: Ran `kwin_wayland --socket dave --output-count 2 konsole` Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D20056 --- plugins/platforms/wayland/egl_wayland_backend.cpp | 6 +++++- plugins/platforms/wayland/egl_wayland_backend.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/platforms/wayland/egl_wayland_backend.cpp b/plugins/platforms/wayland/egl_wayland_backend.cpp index 9113a96f33..74f285bfb1 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.cpp +++ b/plugins/platforms/wayland/egl_wayland_backend.cpp @@ -289,7 +289,10 @@ void EglWaylandBackend::present() void EglWaylandBackend::presentOnSurface(EglWaylandOutput *output) { output->m_waylandOutput->surface()->setupFrameCallback(); - Compositor::self()->aboutToSwapBuffers(); + if (!m_swapping) { + m_swapping = true; + Compositor::self()->aboutToSwapBuffers(); + } if (supportsBufferAge()) { eglSwapBuffers(eglDisplay(), output->m_eglSurface); @@ -321,6 +324,7 @@ QRegion EglWaylandBackend::prepareRenderingFrame() { eglWaitNative(EGL_CORE_NATIVE_ENGINE); startRenderTimer(); + m_swapping = false; return QRegion(); } diff --git a/plugins/platforms/wayland/egl_wayland_backend.h b/plugins/platforms/wayland/egl_wayland_backend.h index 86b5c74e54..98a31b64c0 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.h +++ b/plugins/platforms/wayland/egl_wayland_backend.h @@ -109,6 +109,7 @@ private: WaylandBackend *m_backend; QVector m_outputs; bool m_havePlatformBase; + bool m_swapping = false; friend class EglWaylandTexture; };