monitor: check for invalid workspaces in onConnect

ref #5443
This commit is contained in:
Vaxry 2024-04-05 16:56:46 +01:00
parent 1e8f57c734
commit 0051b078a1

View file

@ -169,6 +169,9 @@ void CMonitor::onConnect(bool noRule) {
setupDefaultWS(monitorRule); setupDefaultWS(monitorRule);
for (auto& ws : g_pCompositor->m_vWorkspaces) { for (auto& ws : g_pCompositor->m_vWorkspaces) {
if (!valid(ws))
continue;
if (ws->m_szLastMonitor == szName || g_pCompositor->m_vMonitors.size() == 1 /* avoid lost workspaces on recover */) { if (ws->m_szLastMonitor == szName || g_pCompositor->m_vMonitors.size() == 1 /* avoid lost workspaces on recover */) {
g_pCompositor->moveWorkspaceToMonitor(ws, this); g_pCompositor->moveWorkspaceToMonitor(ws, this);
ws->startAnim(true, true, true); ws->startAnim(true, true, true);