mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 03:18:49 +03:00
Fix another leak when creating an animated image without an image
This commit is contained in:
parent
b5b580fda5
commit
fc7df50d9a
1 changed files with 6 additions and 1 deletions
|
@ -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()));
|
||||||
|
|
Loading…
Reference in a new issue