Qt Declarative (Quick 2)
Go to file
Vladimir Belyavsky 4b4af2a02c AnimatedImage: avoid loading the same web source in parallel
QQuickAnimatedImage::load() is an overloaded method that is called implicitly from QQuickImage/QQuickImageBase whenever an user changes basic properties such as fillMode, mipmap, sourceSize, etc.

In the case of a web source, this can cause a real problem with
loading failure. For example, when the user changes `fillMode`
immediately after setting the `source` property, like:

 anim.source = <some web image>
 anim.fillMode = Image.PreserveAspectFit

Currently the code above lead to the error "QML AnimatedImage: Error
Reading Animated Image File". This happens because QQAI::load()
initiates a new network request at the same time that one is already
in progress. And when the first reply finishes, we try to read data from the new reply that is not ready yet.

To fix this, we can simply ignore and do nothing on QQAI::load() if there is already active network request (i.e. d->reply is not
nullptr). This has no effect on the actual source change, since we explicitly remove and nullify the active reply in QQAI::setSource().

By this change we also fix potential memory leak, because the old reply
was previously not destroyed properly in QQuickAnimatedImage::load().

Fixes: QTBUG-120555
Pick-to: 6.5
Change-Id: I28f964b51c059855c04a4c80bdce127b3e9974a7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit fec4ac12e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a9b0aec18c)
2024-01-18 22:18:44 +00:00
LICENSES Use SPDX license identifiers 2022-06-11 08:05:15 +02:00
cmake Mark RegExpJitTables.h as non-module header 2023-04-03 15:38:57 +02:00
coin QmlDom: Remove the standalone version of QmlDom 2023-05-04 14:01:25 +02:00
dist
examples Make PieMenu in pointer handlers example work with mouse right-click 2024-01-18 20:55:20 +00:00
features
src AnimatedImage: avoid loading the same web source in parallel 2024-01-18 22:18:44 +00:00
tests AnimatedImage: avoid loading the same web source in parallel 2024-01-18 22:18:44 +00:00
tools qmllint: Add response file support 2023-12-15 12:46:14 +00:00
.cmake.conf Bump version to 6.6.2 2023-11-17 08:10:42 +02:00
.gitattributes qmlformat: improve testing of file based options 2021-11-04 13:35:48 +01:00
.gitignore Move imagine/musicplayer to tests/manual/imagine/musicplayer 2023-07-10 13:37:08 +00:00
.gitmodules
.tag Use tree hash rather than commit hash in .tag file 2022-01-25 23:55:27 +01:00
CMakeLists.txt CMake: Add the Svg package to OPTIONAL_COMPONENTS 2023-08-22 08:37:36 +00:00
README.md Rewrite README.md 2021-08-12 13:15:17 +00:00
configure.cmake Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-09-07 17:01:30 +02:00
dependencies.yaml Update dependencies on '6.6' in qt/qtdeclarative 2024-01-18 14:27:01 +00:00
qt_cmdline.cmake Remove "2" from Qt Quick Controls directories 2022-12-01 10:26:20 +08:00
qtdeclarative.doxy
sync.profile qmlls: move into own private static library 2023-02-07 19:23:13 +01:00