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) { if (!n) {
n = window()->createImageNode(); n = window()->createImageNode();
n->setOwnsTexture(true); n->setOwnsTexture(true);
// n->setFlags(QSGNode::OwnedByParent | QSGNode::OwnsGeometry |
// GSGNode::OwnsMaterial);
n->setFlags(QSGNode::OwnedByParent);
} }
// n->setTexture(nullptr); // n->setTexture(nullptr);
auto img = movie.currentImage(); auto img = movie.currentImage();
if (!img.isNull()) if (!img.isNull())
n->setTexture(window()->createTextureFromImage(img)); n->setTexture(window()->createTextureFromImage(img));
else else {
delete n;
return nullptr; return nullptr;
}
n->setSourceRect(img.rect()); n->setSourceRect(img.rect());
n->setRect(QRect(0, 0, width(), height())); n->setRect(QRect(0, 0, width(), height()));