sessionLock: don't sendLocked when session lock has already been destoyed (#7150)

* sessionLock: reset m_pSessionLock on destroy

* sessionLock: only send locked when resource is good
This commit is contained in:
Maximilian Seidler 2024-08-02 15:25:51 +02:00 committed by GitHub
parent 09bb5658b7
commit 592b4a709c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,7 +71,8 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
g_pHyprRenderer->damageMonitor(m.get());
});
m_pSessionLock->listeners.destroy = pLock->events.destroyed.registerListener([](std::any data) {
m_pSessionLock->listeners.destroy = pLock->events.destroyed.registerListener([this](std::any data) {
m_pSessionLock.reset();
g_pCompositor->focusSurface(nullptr);
for (auto& m : g_pCompositor->m_vMonitors)
@ -104,7 +105,7 @@ SSessionLockSurface* CSessionLockManager::getSessionLockSurfaceForMonitor(uint64
// We don't want the red screen to flash.
float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
if (!m_pSessionLock)
return 0.F;
return 1.F;
const auto& NOMAPPEDSURFACETIMER = m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.find(id);
@ -123,7 +124,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
m_pSessionLock->m_lockedMonitors.emplace(id);
const auto MONITORS = g_pCompositor->m_vMonitors;
const bool LOCKED = std::all_of(MONITORS.begin(), MONITORS.end(), [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
if (LOCKED) {
if (LOCKED && m_pSessionLock->lock->good()) {
m_pSessionLock->lock->sendLocked();
m_pSessionLock->m_hasSentLocked = true;
}