Fix another leak when creating an animated image without an image

This commit is contained in:
Nicolas Werner 2021-08-29 19:24:14 +02:00
parent b5b580fda5
commit fc7df50d9a
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -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()));