Skip to content

Commit c6497a7

Browse files
authored
internal: Prevent double-free in attemptDirectScanout (#10974)
1 parent 9517d0e commit c6497a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/helpers/Monitor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,10 @@ bool CMonitor::attemptDirectScanout() {
15541554
// lock buffer while DRM/KMS is using it, then release it when page flip happens since DRM/KMS should be done by then
15551555
// btw buffer's syncReleaser will take care of signaling release point, so we don't do that here
15561556
PBUFFER->lock();
1557-
PBUFFER->onBackendRelease([PBUFFER]() { PBUFFER->unlock(); });
1557+
PBUFFER->onBackendRelease([wb = WP<IHLBuffer>{PBUFFER}] {
1558+
if (wb)
1559+
wb->unlock();
1560+
});
15581561

15591562
return true;
15601563
}

0 commit comments

Comments
 (0)