monitors: fix segfault on non-unsafe remove

This commit is contained in:
vaxerski 2023-03-16 01:04:54 +00:00
parent 3e261b1fa7
commit d9d57ce39a
2 changed files with 3 additions and 1 deletions

View file

@ -363,7 +363,7 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
// cleanup if not unsafe // cleanup if not unsafe
if (!g_pCompositor->m_bUnsafeState) { if (!g_pCompositor->m_bUnsafeState) {
Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name); Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->szName.c_str());
std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; }); std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
} }

View file

@ -694,6 +694,8 @@ void Events::listener_commitWindow(void* owner, void* data) {
if (!PWINDOW->m_bMappedX11 || PWINDOW->isHidden() || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11)) if (!PWINDOW->m_bMappedX11 || PWINDOW->isHidden() || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
return; return;
PWINDOW->updateSurfaceOutputs();
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y); g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
// Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM! // Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM!