From 064f0d3d23097cb181166c3e966287490773f23c Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Fri, 9 Nov 2018 12:25:01 +0100 Subject: Fix leaking textures and animation resources by software backend QQuickStyleItem1::updatePaintNode assumes every instance of QSGNinePathNode (QSGSoftwareNinePatchNode for software backend) to own new texture object on setTexture. Instance of QQuickAnimationController is also assumed to be deleted by render loop on window destroy. Fixes: QTBUG-69290 Change-Id: Ibd22229108c986c1c115600280482cea01bf4160 Reviewed-by: Andy Nichols --- .../scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp | 7 ++++--- .../scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp index 1463681fa3..68341ebb3e 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp @@ -144,10 +144,11 @@ void QSGSoftwareNinePatchNode::setTexture(QSGTexture *texture) QSGSoftwarePixmapTexture *pt = qobject_cast(texture); if (!pt) { qWarning() << "Image used with invalid texture format."; - return; + } else { + m_pixmap = pt->pixmap(); + markDirty(DirtyMaterial); } - m_pixmap = pt->pixmap(); - markDirty(DirtyMaterial); + delete texture; } void QSGSoftwareNinePatchNode::setBounds(const QRectF &bounds) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp index b400473128..f5a41410ee 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -98,6 +99,8 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window) if (m_windows.size() == 0) { rc->invalidate(); } + + delete d->animationController; } void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose) -- cgit v1.2.3