From 7ec2aed55f35a56d40a9a833ef0700574ab2dd39 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 31 Mar 2022 21:58:33 +0200 Subject: [PATCH] More checks in popups --- src/events/Popups.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index 90e0851d..6cc6a34e 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -58,6 +58,8 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) { void Events::listener_newPopup(void* owner, void* data) { SLayerSurface* layersurface = (SLayerSurface*)owner; + ASSERT(layersurface); + Debug::log(LOG, "New layer popup created from surface %x", layersurface); const auto WLRPOPUP = (wlr_xdg_popup*)data; @@ -74,6 +76,8 @@ void Events::listener_newPopup(void* owner, void* data) { void Events::listener_newPopupXDG(void* owner, void* data) { CWindow* PWINDOW = (CWindow*)owner; + ASSERT(PWINDOW); + Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str()); const auto WLRPOPUP = (wlr_xdg_popup*)data; @@ -91,7 +95,12 @@ void Events::listener_newPopupXDG(void* owner, void* data) { void Events::listener_newPopupFromPopupXDG(void* owner, void* data) { SXDGPopup* PPOPUP = (SXDGPopup*)owner; - Debug::log(LOG, "New layer popup created from XDG popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str()); + ASSERT(PPOPUP); + + if (PPOPUP->parentWindow) + Debug::log(LOG, "New popup created from XDG Window popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str()); + else + Debug::log(LOG, "New popup created from Non-Window popup %x", PPOPUP); const auto WLRPOPUP = (wlr_xdg_popup*)data; @@ -102,6 +111,7 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) { PNEWPOPUP->parentPopup = PPOPUP; PNEWPOPUP->lx = PPOPUP->lx; PNEWPOPUP->ly = PPOPUP->ly; + PNEWPOPUP->parentWindow = PPOPUP->parentWindow; createNewPopup(WLRPOPUP, PNEWPOPUP); } @@ -109,6 +119,8 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) { void Events::listener_mapPopupXDG(void* owner, void* data) { SXDGPopup* PPOPUP = (SXDGPopup*)owner; + ASSERT(PPOPUP); + Debug::log(LOG, "New XDG Popup mapped"); PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP); @@ -120,6 +132,8 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) { SXDGPopup* PPOPUP = (SXDGPopup*)owner; Debug::log(LOG, "XDG Popup unmapped"); + ASSERT(PPOPUP); + SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree); PPOPUP->pSurfaceTree = nullptr; @@ -128,6 +142,8 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) { void Events::listener_destroyPopupXDG(void* owner, void* data) { SXDGPopup* PPOPUP = (SXDGPopup*)owner; + ASSERT(PPOPUP); + Debug::log(LOG, "Destroyed popup XDG %x", PPOPUP); if (PPOPUP->pSurfaceTree) {