aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgthreadedrenderloop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 1318b2c034..76f65e5f85 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -1237,6 +1237,20 @@ void QSGThreadedRenderLoop::windowDestroyed(QQuickWindow *window)
void QSGThreadedRenderLoop::releaseSwapchain(QQuickWindow *window)
{
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
+
+ // Counterintuitive, because this is not needed under normal circumstances
+ // due to the render loop using a dedicated rendercontext per thread, so
+ // per window. Problem is, there are cases like calling destroy(); show();
+ // on the QQuickWindow. (and we get here on SurfaceAboutToBeDestroyed, i.e.
+ // from destroy())
+ //
+ // That means recreating the native window and all the related graphics
+ // infrastructure, but the rendercontext stays around. So still have to
+ // notify the renderer to invalidate the relevant objects in the caches.
+ //
+ if (wd->renderer)
+ wd->renderer->invalidatePipelineCacheDependency(wd->rpDescForSwapchain);
+
delete wd->rpDescForSwapchain;
wd->rpDescForSwapchain = nullptr;
delete wd->swapchain;
@@ -1419,8 +1433,9 @@ bool QSGThreadedRenderLoop::eventFilter(QObject *watched, QEvent *event)
w->thread->waitCondition.wait(&w->thread->mutex);
w->thread->mutex.unlock();
}
- window->removeEventFilter(this);
}
+ // keep this filter on the window - needed for uncommon but valid
+ // sequences of calls like window->destroy(); window->show();
}
break;
default: