Commit a3b50500 authored by Andreas Haratzis's avatar Andreas Haratzis Committed by David Edmundson
Browse files

Fix use-after-free when the user hovers over an auto-hide plasma panel in wayland...

Edge::handle calls showOnScreenEdge, which (on wayland) eventually calls internalShow, which eventually calls ScreenEdges::reserve, which destroys the same edge.
When showScreenOnEdge returns, 'this' has been freed.
Using a singleshot timer allows Edge::handle to return before the Edge is destroyed.


(cherry picked from commit 71dfd602)
parent 965b20ab
......@@ -715,11 +715,16 @@ void XdgToplevelClient::showOnScreenEdge()
if (!m_plasmaShellSurface) {
return;
}
hideClient(false);
workspace()->raiseClient(this);
if (m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide) {
m_plasmaShellSurface->showAutoHidingPanel();
}
// ShowOnScreenEdge can be called by an Edge, and hideClient could destroy the Edge
// Use the singleshot to avoid use-after-free
QTimer::singleShot(0, [this](){
hideClient(false);
workspace()->raiseClient(this);
if (m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide) {
m_plasmaShellSurface->showAutoHidingPanel();
}
});
}
void XdgToplevelClient::closeWindow()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment