Fix memory leak in some plasma components

A few plasma components cache QSGTexture. Those components rely on
texture references going away with QSGNode users. However, with the
current tear down logic, OffscreenQuickView won't destroy any paint
nodes.

Destroy QQuickRenderControl before QQuickWindow to ensure that are no
paint nodes left alive after OffscreenQuickView.

BUG: 444429
BUG: 444381
BUG: 444077
BUG: 444306
This commit is contained in:
Vlad Zahorodnii 2021-12-13 12:53:32 +02:00
parent 3fb14035cd
commit 64f2cdf9ed

View file

@ -176,12 +176,15 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E
OffscreenQuickView::~OffscreenQuickView()
{
if (d->m_glcontext) {
d->m_glcontext->makeCurrent(d->m_offscreenSurface.data());
// close the view whilst we have an active GL context
delete d->m_view;
d->m_view = nullptr;
d->m_renderControl->invalidate();
d->m_glcontext->makeCurrent(d->m_offscreenSurface.data());
}
delete d->m_renderControl; // Always delete render control first.
d->m_renderControl = nullptr;
delete d->m_view;
d->m_view = nullptr;
}
bool OffscreenQuickView::automaticRepaint() const