aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-08-06 13:01:42 +0200
committerVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-08-07 13:20:37 +0000
commit3df5ad9d247b194401d61c3ffb4b816ec239bded (patch)
treea51abe6117c3672b8596f9d3d9a4d7910eac15e8 /src/quick/scenegraph
parent26c1748497028912f8ab6661ff90bda5df5173b4 (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 Pick-to: 5.15 5.12 Fixes: QTBUG-65170 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-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 0c1850f91f..28c9f3dac6 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -767,10 +767,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();
}