commit-timing: avoid use-after-free in timer callback (#13271)

This commit is contained in:
Kamikadze 2026-02-14 18:09:25 +05:00 committed by GitHub
parent e5a2b9e5b0
commit 48176160ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,11 +39,11 @@ CCommitTimerResource::CCommitTimerResource(UP<CWpCommitTimerV1>&& resource_, SP<
if (!state->timer) {
state->timer = makeShared<CEventLoopTimer>(
state->pendingTimeout,
[this, state](SP<CEventLoopTimer> self, void* data) {
if (!m_surface || !state)
[surface = m_surface, state](SP<CEventLoopTimer> self, void* data) {
if (!surface || !state)
return;
m_surface->m_stateQueue.unlock(state, LOCK_REASON_TIMER);
surface->m_stateQueue.unlock(state, LOCK_REASON_TIMER);
},
nullptr);
g_pEventLoopManager->addTimer(state->timer);