From fc7df50d9aaa798ab4fdebf42064b1ad2f85d8b0 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 29 Aug 2021 19:24:14 +0200 Subject: [PATCH] Fix another leak when creating an animated image without an image --- src/ui/MxcAnimatedImage.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/MxcAnimatedImage.cpp b/src/ui/MxcAnimatedImage.cpp index 3db5ef60..c691bab0 100644 --- a/src/ui/MxcAnimatedImage.cpp +++ b/src/ui/MxcAnimatedImage.cpp @@ -155,14 +155,19 @@ MxcAnimatedImage::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeD if (!n) { n = window()->createImageNode(); n->setOwnsTexture(true); + // n->setFlags(QSGNode::OwnedByParent | QSGNode::OwnsGeometry | + // GSGNode::OwnsMaterial); + n->setFlags(QSGNode::OwnedByParent); } // n->setTexture(nullptr); auto img = movie.currentImage(); if (!img.isNull()) n->setTexture(window()->createTextureFromImage(img)); - else + else { + delete n; return nullptr; + } n->setSourceRect(img.rect()); n->setRect(QRect(0, 0, width(), height()));