diff options
| author | matjam <chrome@stupendous.net> | 2026-03-09 14:45:21 -0700 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-03-10 10:06:24 +0000 |
| commit | b9ddb4bb26275115e9c9ff03b3d87c6e2fd96c45 (patch) | |
| tree | 2c8dd1d3b010bbecf841541a8fd9d2b1b7b1e1c5 /src/layout/space | |
| parent | 8217dabc80814b6d2741dc0a75c8398fc770b26c (diff) | |
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.
Diffstat (limited to 'src/layout/space')
| -rw-r--r-- | src/layout/space/Space.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/layout/space/Space.cpp b/src/layout/space/Space.cpp index db3925f6..a02ba517 100644 --- a/src/layout/space/Space.cpp +++ b/src/layout/space/Space.cpp @@ -21,8 +21,16 @@ CSpace::CSpace(PHLWORKSPACE parent) : m_parent(parent) { // NOLINTNEXTLINE m_geomUpdateCallback = Event::bus()->m_events.monitor.layoutChanged.listen([this] { + // During monitor disconnect/reconnect (e.g. sleep/wake), some workspaces + // may have stale or null monitors. Guard against that to avoid crashing + // when recalculating layout for workspaces mid-migration. + if (!m_parent || !m_parent->m_monitor) + return; + recheckWorkArea(); - m_algorithm->recalculate(); + + if (m_algorithm) + m_algorithm->recalculate(); }); } |
