From 15316aaa311ce27982d4df3c9514f042290853a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ab=C3=ADlio=20Costa?= Date: Thu, 1 Feb 2024 03:09:31 +0000 Subject: [PATCH] subsurfaceTree: Fix nullptr crash when disconnecting a monitor (#4577) I was able to reproduce this frequently by having a kitty terminal on an monitor running the following command and then unplugging that monitor: `while true; do echo "" && sleep 0.02; done` --- src/helpers/SubsurfaceTree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/SubsurfaceTree.cpp b/src/helpers/SubsurfaceTree.cpp index f9b1cb72..a8226e19 100644 --- a/src/helpers/SubsurfaceTree.cpp +++ b/src/helpers/SubsurfaceTree.cpp @@ -262,7 +262,7 @@ void Events::listener_commitSubsurface(void* owner, void* data) { // tearing: if solitary, redraw it. This still might be a single surface window const auto PMONITOR = g_pCompositor->getMonitorFromID(pNode->pWindowOwner->m_iMonitorID); - if (PMONITOR->solitaryClient == pNode->pWindowOwner && pNode->pWindowOwner->canBeTorn() && PMONITOR->tearingState.canTear && + if (PMONITOR && PMONITOR->solitaryClient == pNode->pWindowOwner && pNode->pWindowOwner->canBeTorn() && PMONITOR->tearingState.canTear && pNode->pSurface->wlr()->current.committed & WLR_SURFACE_STATE_BUFFER) { CRegion damageBox{&pNode->pSurface->wlr()->buffer_damage};