Fix heap-use-after-free with rhi-based backingstore

Task-number: QTBUG-102030
Change-Id: I6b05007c6ae3d653197c5680b9fc5768b0e3690f
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
bb10
Laszlo Agocs 2022-03-28 14:50:18 +02:00
parent 7e4c2ac711
commit a86ee60887
1 changed files with 3 additions and 2 deletions

View File

@ -219,11 +219,12 @@ bool QBackingStoreRhiSupportWindowWatcher::eventFilter(QObject *obj, QEvent *eve
auto it = m_rhiSupport->m_swapchains.find(window);
if (it != m_rhiSupport->m_swapchains.end()) {
qCDebug(lcQpaBackingStore) << "SurfaceAboutToBeDestroyed received for tracked window" << window << "cleaning up swapchain";
it->reset();
auto data = *it;
m_rhiSupport->m_swapchains.erase(it);
data.reset(); // deletes 'this'
}
}
return QObject::eventFilter(obj, event);
return false;
}
QSurface::SurfaceType QBackingStoreRhiSupport::surfaceTypeForConfig(const QPlatformBackingStoreRhiConfig &config)