From 10146f5ec50caeae2d835f5f6296137e2ac6f243 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 3 Apr 2024 20:42:38 +0100 Subject: [PATCH] core: fix some crash conditions around workspace ptrs in CWindow ref #5402, supersedes #5409 --- src/Compositor.cpp | 2 +- src/render/Renderer.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 3b7b5d9b..033af696 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1241,7 +1241,7 @@ CWindow* CCompositor::getFullscreenWindowOnWorkspace(const int& ID) { } bool CCompositor::isWorkspaceVisible(PHLWORKSPACE w) { - return w->m_bVisible; + return valid(w) && w->m_bVisible; } PHLWORKSPACE CCompositor::getWorkspaceByID(const int& id) { diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index b43f3a2d..af6b7aae 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -220,6 +220,9 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor) { if (!pWindow->m_pWorkspace && !pWindow->m_bFadingOut) return false; + if (!pWindow->m_pWorkspace && pWindow->m_bFadingOut) + return pWindow->workspaceID() == pMonitor->activeWorkspaceID(); + if (pWindow->m_bPinned) return true; @@ -1760,7 +1763,7 @@ void CHyprRenderer::damageWindow(CWindow* pWindow, bool forceFull) { windowBox.translate(pWindow->m_vFloatingOffset); for (auto& m : g_pCompositor->m_vMonitors) { - if (g_pHyprRenderer->shouldRenderWindow(pWindow, m.get()) || forceFull) { // only damage if window is rendered on monitor + if (forceFull || g_pHyprRenderer->shouldRenderWindow(pWindow, m.get())) { // only damage if window is rendered on monitor CBox fixedDamageBox = {windowBox.x - m->vecPosition.x, windowBox.y - m->vecPosition.y, windowBox.width, windowBox.height}; fixedDamageBox.scale(m->scale); m->addDamage(&fixedDamageBox);