Skip to content

Commit 3df5ad9

Browse files
author
VaL Doroshchuk
committed
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>
1 parent 26c1748 commit 3df5ad9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/quick/scenegraph/qsgrenderloop.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,18 @@ QImage QSGGuiThreadRenderLoop::grab(QQuickWindow *window)
767767
void QSGGuiThreadRenderLoop::maybeUpdate(QQuickWindow *window)
768768
{
769769
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
770-
if (!cd->isRenderable() || !m_windows.contains(window))
770+
if (!m_windows.contains(window))
771771
return;
772772

773+
// Even if the window is not renderable,
774+
// renderWindow() called on different window
775+
// should not delete QSGTexture's
776+
// from this unrenderable window.
773777
m_windows[window].updatePending = true;
778+
779+
if (!cd->isRenderable())
780+
return;
781+
774782
window->requestUpdate();
775783
}
776784

0 commit comments

Comments
 (0)