core: some guards for reconnecting monitors

This commit is contained in:
Maximilian Seidler 2025-03-08 10:49:45 +01:00
parent 78ad1d46b5
commit e1ffa651fa
2 changed files with 13 additions and 2 deletions

View file

@ -46,6 +46,16 @@ void COutput::create(WP<COutput> pSelf, SP<CCWlOutput> pWlOutput, uint32_t _name
}
void COutput::createSessionLockSurface() {
if (!m_self.valid()) {
Debug::log(ERR, "output {} dead??", m_ID);
return;
}
if (m_sessionLockSurface) {
Debug::log(ERR, "output {} already has a session lock surface", m_ID);
return;
}
m_sessionLockSurface = makeUnique<CSessionLockSurface>(m_self.lock());
}

View file

@ -285,8 +285,9 @@ void CHyprlock::run() {
m_sWaylandState.sessionLock =
makeShared<CCExtSessionLockManagerV1>((wl_proxy*)wl_registry_bind((wl_registry*)r->resource(), name, &ext_session_lock_manager_v1_interface, 1));
else if (IFACE == wl_output_interface.name) {
m_vOutputs.emplace_back(makeShared<COutput>());
m_vOutputs.back()->create(m_vOutputs.back(), makeShared<CCWlOutput>((wl_proxy*)wl_registry_bind((wl_registry*)r->resource(), name, &wl_output_interface, 4)), name);
const auto POUTPUT = makeShared<COutput>();
POUTPUT->create(POUTPUT, makeShared<CCWlOutput>((wl_proxy*)wl_registry_bind((wl_registry*)r->resource(), name, &wl_output_interface, 4)), name);
m_vOutputs.emplace_back(POUTPUT);
} else if (IFACE == wp_cursor_shape_manager_v1_interface.name)
g_pSeatManager->registerCursorShape(
makeShared<CCWpCursorShapeManagerV1>((wl_proxy*)wl_registry_bind((wl_registry*)r->resource(), name, &wp_cursor_shape_manager_v1_interface, 1)));