Skip to content

backends/x11: Fix crash that happens when toggling compositing

Vlad Zahorodnii requested to merge work/cherry-pick-7a472fca into Plasma/6.1

When the GLX or the EGL backend is destroyed, it is going to reset the RenderLoop state, including the number of frames in flight. It does so because of the historical reasons. At the time, there was no output frame object to track the lifecycle of a frame.

After introducing the OutputFrame and hooking it into the RenderLoop, the pending frame count will be reset automatically in RenderLoop when the GLX or the EGL backend is destroyed. But we forgot to remove the invalidate() function calls. So, when the GLX backend goes down, it resets the pending frame count to zero and then it destroys the pending OutputFrame object, which would result in decreasing the pending frame count by 1 and triggering an assert in the RenderLoopPrivate::notifyFrameDropped() function.

Since there is the OutputFrame helper now, the invalidate() function can be dropped. Technically, the invalidate function did more than just reset pendingFrameCount to 0, for example also stop the compositeTime. But that should be fairly harmless new behavior.

(cherry picked from commit 7a472fca)

Co-authored-by: Vlad Zahorodnii vlad.zahorodnii@kde.org

Merge request reports