-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.3, 6.6.1, 6.7.0 Beta1
-
None
-
-
fec4ac12e (dev), a9b0aec18 (6.7), 4b4af2a02 (6.6), 9cb527ba1 (tqtc/lts-6.5)
There are several issues with AnimatedImage when using web-source.
1. Image loading may fail if you change some image properties such as fillMode, mipmap, etc. immediately after setting the source (see code sample for details).
Code sample:
import QtQuick import QtQuick.Controls import QtQuick.Window Window { width: 300 height: 300 visible: true AnimatedImage { id: image anchors.fill: parent function resetDefaults() { source = '' sourceSize = undefined // available only in Qt 6.6.0 and above fillMode = Image.Stretch mipmap = false cache = true } } Button { text: "Press me!" onClicked: { image.resetDefaults() image.source = 'https://media.tenor.com/BDcB-euFv5IAAAAC/kermit-wat.gif' // this triggers QQuickAnimatedImage::load() internally image.fillMode = Image.PreserveAspectFit // or //image.mipmap = true // or //image.cache = false // or (since Qt 6.6.0) //image.sourceSize = Qt.size(200, 200) } } }
Just launch it and press "Press me!" button.
As a result you'll see that the image is failed to load and there is an error in debug output.
qrc:/untitled/main.qml:10:5: QML AnimatedImage: Error Reading Animated Image File https://media.tenor.com/BDcB-euFv5IAAAAC/kermit-wat.gif
2. There is possible memory leak on QQuickAnimatedImage::load().
Every time when it's triggered not directly from setSource() we leak d->reply.
#if QT_CONFIG(qml_network) d->setStatus(Loading); d->setProgress(0); QNetworkRequest req(d->url); req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); d->reply = qmlEngine(this)->networkAccessManager()->get(req); connect(d->reply, &QNetworkReply::finished, this, &QQuickAnimatedImage::movieRequestFinished); connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(requestProgress(qint64,qint64))); #endif
- relates to
-
QTBUG-120755 AnimatedImage is not played automatically (specific case)
-
- Reported
-