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.
This commit is contained in:
parent
2e93829259
commit
71dfd60284
1 changed files with 10 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue