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-07 15:27:37 +0000
commit8721196cc73021709ef13e1a6e74aedd34bcfc79 (patch)
tree5234956778af7ebeaca64ad4ec76d79a9f2531a8
parentd6dfba4428c3ac626e2b12312cb25901c75c1ea5 (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 2e91bafa7c..28f75b71d6 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -502,10 +502,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();
}