summaryrefslogtreecommitdiff
path: root/src/events/Popups.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-03-23 00:22:28 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-03-23 00:22:49 +0000
commit3a3a3f7bdb4057a614ff939eec6a40ef63fbe327 (patch)
treecf63488e28388ca75853b784906d0a81da1bc3b6 /src/events/Popups.cpp
parentcf51a318078c82040eaeab29664bc34144ee1d62 (diff)
popups: fix heap-use-after-free
Diffstat (limited to 'src/events/Popups.cpp')
-rw-r--r--src/events/Popups.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp
index f88e6917..b56d0792 100644
--- a/src/events/Popups.cpp
+++ b/src/events/Popups.cpp
@@ -173,11 +173,6 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP);
- if (PPOPUP->parentWindow)
- std::erase(PPOPUP->parentWindow->m_lPopupSurfaces, PPOPUP->popup->base->surface);
- else if (PPOPUP->parentLS)
- std::erase(PPOPUP->parentLS->popupSurfaces, PPOPUP->popup->base->surface);
-
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
int lx = 0, ly = 0;
@@ -188,6 +183,11 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
+ if (PPOPUP->parentWindow)
+ std::erase(PPOPUP->parentWindow->m_lPopupSurfaces, PPOPUP->popup->base->surface);
+ else if (PPOPUP->parentLS)
+ std::erase(PPOPUP->parentLS->popupSurfaces, PPOPUP->popup->base->surface);
+
PPOPUP->pSurfaceTree = nullptr;
g_pInputManager->simulateMouseMovement(); // to focus and return back to an appropriate surface