diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-11-17 16:25:38 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-11-17 18:09:00 +0100 |
commit | 45254660d07c82399162931716e569737830802e (patch) | |
tree | 855c0081893566fc10ee9af58f3e768f5c76ff62 /src/quick/scenegraph | |
parent | c081f2c603a18631c1846876385d9d4f4a04d52b (diff) |
Fix potentially missing endFrame() in threaded render loop
Upon a QWindow destroy() and show() we can get to syncAndRenderer
with sync not requested. It will be followed by a full sync+render
request afterwards, but first we need to gracefully survive that
somewhat obscure initial round (obscure because the window is fully
usable, so we get a swapchain, but then we do not sync, so there is no
QSGRenderer created)
Exhibited by tst_qquickwindow::headless. It correctly showed a warning
on all platforms and rhi backends, but was only fatal on macOS and Metal
for some reason.
Fixes: QTBUG-88513
Change-Id: I0396b648af0fd2bef2964b79a28359a7f806530d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index a8668fd0c0..9b520d53f2 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -810,6 +810,11 @@ void QSGRenderThread::syncAndRender() QQuickProfiler::SceneGraphRenderLoopSync, 1); Q_TRACE(QSG_swap_entry); qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- window not ready, skipping render"); + // Make sure a beginFrame() always gets an endFrame(). We could have + // started a frame but then not have a valid renderer (if there was no + // sync). So gracefully handle that. + if (cd->swapchain && rhi->isRecordingFrame()) + rhi->endFrame(cd->swapchain, QRhi::SkipPresent); } qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- rendering done"); |