Fix for potential use-after-free introduced in a3b50500

If showOnScreenEdge is called, immediately followed by the client's destruction, it's possible that the next event queue process will call raiseClient with a destroyed client.
We avoid this by using singleShot that is lifetime-aware.
This commit is contained in:
Andreas Haratzis 2020-09-23 18:52:11 -07:00 committed by Vlad Zahorodnii
parent 0c266e760b
commit 1dbe3708f5

View file

@ -718,7 +718,7 @@ void XdgToplevelClient::showOnScreenEdge()
// 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](){
QTimer::singleShot(0, this, [this](){
hideClient(false);
workspace()->raiseClient(this);
if (m_plasmaShellSurface->panelBehavior() == PlasmaShellSurfaceInterface::PanelBehavior::AutoHide) {