summaryrefslogtreecommitdiff
path: root/src/layout/space/Space.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/space/Space.cpp')
-rw-r--r--src/layout/space/Space.cpp10
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();
});
}