summaryrefslogtreecommitdiff
path: root/src/protocols/SessionLock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocols/SessionLock.cpp')
-rw-r--r--src/protocols/SessionLock.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp
index 88231f38..de2b96f2 100644
--- a/src/protocols/SessionLock.cpp
+++ b/src/protocols/SessionLock.cpp
@@ -62,11 +62,11 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
if (m_surface)
m_surface->enter(m_monitor.lock());
+
+ m_listeners.monitorMode = m_monitor->m_events.modeChanged.listen([this] { sendConfigure(); });
}
sendConfigure();
-
- m_listeners.monitorMode = m_monitor->m_events.modeChanged.listen([this] { sendConfigure(); });
}
CSessionLockSurface::~CSessionLockSurface() {
@@ -203,8 +203,17 @@ void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) {
void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id, wl_resource* surface, wl_resource* output) {
LOGM(Log::DEBUG, "New sessionLockSurface with id {}", id);
- auto PSURFACE = CWLSurfaceResource::fromResource(surface);
- auto PMONITOR = CWLOutputResource::fromResource(output)->m_monitor.lock();
+ auto PSURFACE = CWLSurfaceResource::fromResource(surface);
+ auto OUTPUTRES = CWLOutputResource::fromResource(output);
+ if (!OUTPUTRES) {
+ LOGM(Log::ERR, "onGetLockSurface: invalid output resource");
+ return;
+ }
+ auto PMONITOR = OUTPUTRES->m_monitor.lock();
+ if (!PMONITOR) {
+ LOGM(Log::ERR, "onGetLockSurface: monitor is gone for output resource");
+ return;
+ }
SP<CSessionLock> sessionLock;
for (auto const& l : m_locks) {