wayland: Properly clear transaction list in TransactionDmaBufLocker

Transaction::unlock() can destroy buffer reference and thus also destroy
TransactionDmaBufLocker.
This commit is contained in:
Vlad Zahorodnii 2023-09-12 13:59:20 +03:00
parent 00c12aa766
commit 693fa8a968

View file

@ -45,10 +45,11 @@ TransactionDmaBufLocker::TransactionDmaBufLocker(const DmaBufAttributes *attribu
notifier->setEnabled(false);
m_pending.removeOne(notifier);
if (m_pending.isEmpty()) {
for (Transaction *transition : std::as_const(m_transactions)) {
const auto transactions = m_transactions; // unlock() may destroy this
m_transactions.clear();
for (Transaction *transition : transactions) {
transition->unlock();
}
m_transactions.clear();
}
});
m_notifiers.emplace_back(notifier);