Fix DrmOutput sometimes being freed with a pending pageflip, often when waking from sleep.

It is possible for updateOutputs to be called when a pageflip is pending.
Freeing a DrmOutput with a pending pageflip is not allowed (see ~DrmOutput assert - the page flip handler will be called on the freed memory, possibly leading to use-after-free).
This works around the problem by delaying the destruction with teardown().

BUG: 422460
This commit is contained in:
Andreas Haratzis 2020-07-05 23:36:03 -07:00
parent 9e1bb1f130
commit 6c9026628c

View file

@ -519,7 +519,11 @@ bool DrmBackend::updateOutputs()
emit screensQueried();
}
qDeleteAll(removedOutputs);
for(DrmOutput* removedOutput : removedOutputs) {
removedOutput->teardown();
removedOutput->m_crtc = nullptr;
removedOutput->m_conn = nullptr;
}
qDeleteAll(oldConnectors);
qDeleteAll(oldCrtcs);
return true;