diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-28 16:58:00 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-03 10:51:26 +0200 |
commit | 5e0bf417fb38c53d4ae43f9f84fe42461cd2e00c (patch) | |
tree | c0dcc0954ce73447819841202cacd7615715aab6 /src/quick/scenegraph/qsgrenderloop.cpp | |
parent | ff6369767321afc49b37645bb6b85d3556921645 (diff) |
Fix handling of destroy-show and re-enable the zoom test for qmlpreview
Fixes: QTBUG-84059
Change-Id: Id70c043f96e9525a5a6053efbf99c5ea3408da65
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 12797c196b..9306d3351a 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -466,7 +466,9 @@ void QSGGuiThreadRenderLoop::releaseSwapchain(QQuickWindow *window) QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window); // Unlike the threaded render loop, this one reuses the same rendercontext - // for all QQuickWindows for the entire lifetime of the render loop. + // for all QQuickWindows for the entire lifetime of the render loop. (and + // even if it wouldn't, special cases like destroy() - show() on the + // QQuickWindow still needed this) // Therefore the renderer, if there is one, needs to be notified about the // destruction of certain resources because they may be referenced from // per-rendercontext data structures. @@ -489,10 +491,10 @@ bool QSGGuiThreadRenderLoop::eventFilter(QObject *watched, QEvent *event) // this is the proper time to tear down the swapchain (while the native window and surface are still around) if (static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) { QQuickWindow *w = qobject_cast<QQuickWindow *>(watched); - if (w) { + if (w) releaseSwapchain(w); - w->removeEventFilter(this); - } + // keep this filter on the window - needed for uncommon but valid + // sequences of calls like window->destroy(); window->show(); } break; default: |