Teardown view before QQuickRenderControl

Deleting QQuickWindow will force any remaining runnables to complete.
This is important for any items (such as our new ThumbnailItem) that
deletes resources in queued cleanups.

We need to invoke this manually whilst we still have an active render
control with a valid context, otherwise remaining runnables will no-op.

We also then want to manually delete our scene contents before the view
so they're not orphaned temporarily.

This fixes a memory leak observed with the new Overview effect.
This commit is contained in:
David Edmundson 2021-08-09 11:47:28 +01:00 committed by Vlad Zahorodnii
parent fdb1914a83
commit 60255fd7a9

View file

@ -124,6 +124,9 @@ EffectQuickView::~EffectQuickView()
{
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->doneCurrent();
}
@ -335,6 +338,7 @@ EffectQuickScene::EffectQuickScene(QObject *parent, EffectQuickView::ExportMode
EffectQuickScene::~EffectQuickScene()
{
delete d->qmlObject;
}
void EffectQuickScene::setSource(const QUrl &source)