aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-08-06 13:01:42 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-08-09 14:29:54 +0000
commit121cfa92daf310df382ddf3d1171ae0d94274f14 (patch)
treeffbd699ed99b6ee90c1a5d4cf1aa10672412196e
parent94d507d9f24fafba92a7bdc6b706fe48be350c48 (diff)
Fix crash when QSGTexture is deleted in rc->endSync()
1. When the quick pixmap is cached, it might be deleted by a timer. 2. When its QQuickPixmapData is being deleted, its QQuickTextureFactory is also deleted. Which informs the QSGRenderContext to postpone deleting of a texture that belongs to this texture factory. 3. When an update is called on the _hidden_ window, QSGGuiThreadRenderLoop::renderWindow calls rc->endSync(), which deletes postponed the texture from 2. After that the texture must not be used. But some QSGNode can still keep pointer to the deleted QSGTexture. and when updatePaintNode is called, it might produce a crash. So, suggesting a fix to inform the render loop that there is a window with pending updates, and no need to delete textures. Change-Id: I1487595dbb686e682ac3b91b9c3d21f401095daa Fixes: QTBUG-65170 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 3df5ad9d247b194401d61c3ffb4b816ec239bded) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 94f15b55d4..c96129e660 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -870,10 +870,18 @@ QImage QSGGuiThreadRenderLoop::grab(QQuickWindow *window)
void QSGGuiThreadRenderLoop::maybeUpdate(QQuickWindow *window)
{
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
- if (!cd->isRenderable() || !m_windows.contains(window))
+ if (!m_windows.contains(window))
return;
+ // Even if the window is not renderable,
+ // renderWindow() called on different window
+ // should not delete QSGTexture's
+ // from this unrenderable window.
m_windows[window].updatePending = true;
+
+ if (!cd->isRenderable())
+ return;
+
window->requestUpdate();
}