From b9ddb4bb26275115e9c9ff03b3d87c6e2fd96c45 Mon Sep 17 00:00:00 2001 From: matjam Date: Mon, 9 Mar 2026 14:45:21 -0700 Subject: layout: fix crash on monitor reconnect due to stale workspace state Guard against null/expired workspace and monitor pointers during layout recalculation triggered by arrangeMonitors after sleep/wake. --- src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/layout/algorithm/tiled/scrolling') diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp index 7b9a1752..e3f326e8 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp @@ -422,7 +422,8 @@ SP SScrollingData::atCenter() { } void SScrollingData::recalculate(bool forceInstant) { - if (!algorithm->m_parent->space()->workspace() || algorithm->m_parent->space()->workspace()->m_hasFullscreenWindow) + if (!algorithm->m_parent || !algorithm->m_parent->space() || !algorithm->m_parent->space()->workspace() || !algorithm->m_parent->space()->workspace()->m_monitor || + algorithm->m_parent->space()->workspace()->m_hasFullscreenWindow) return; static const auto PFSONONE = CConfigValue("scrolling:fullscreen_on_one_column"); @@ -1505,6 +1506,9 @@ eScrollDirection CScrollingAlgorithm::getDynamicDirection() { } CBox CScrollingAlgorithm::usableArea() { + if (!m_parent || !m_parent->space()) + return {}; + CBox box = m_parent->space()->workArea(); // doesn't matter, this happens when this algo is about to be destroyed -- cgit v1.2.3