fix crash with reenabling a monitor

This commit is contained in:
vaxerski 2022-08-03 17:42:19 +02:00
parent 587330d864
commit 37068cf4f0

View file

@ -21,6 +21,17 @@ void CMonitor::onConnect(bool noRule) {
return; return;
} }
if (!m_pThisWrap) {
// find the wrap
for (auto& m : g_pCompositor->m_vRealMonitors) {
if (m->ID == ID) {
m_pThisWrap = &m;
break;
}
}
}
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){ if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap); g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
} }
@ -98,6 +109,8 @@ void CMonitor::onConnect(bool noRule) {
activeWorkspace = PNEWWORKSPACE->m_iID; activeWorkspace = PNEWWORKSPACE->m_iID;
scale = monitorRule.scale; scale = monitorRule.scale;
m_pThisWrap = nullptr;
forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering. forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering.
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle); g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);