summaryrefslogtreecommitdiff
path: root/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-perf-1.patch
blob: 326ce2fd9e47692d83da0d1e29b8dfc05137d96a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 350ce1b990460cb2178f369f22fe80803f5645f3 Mon Sep 17 00:00:00 2001
From: Fushan Wen <qydwhotmail@gmail.com>
Date: Sat, 15 Oct 2022 11:40:41 +0800
Subject: [PATCH] avif: return `false` in `canRead()` when `imageIndex >=
 imageCount`

Otherwise when `cache: false` is set in AnimatedImage, QMovie will try
to read the image forever.

BUG: 460085
FIXED-IN: 5.100
---
 src/imageformats/avif.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/imageformats/avif.cpp b/src/imageformats/avif.cpp
index 2865a4e..c4f7a0f 100644
--- a/src/imageformats/avif.cpp
+++ b/src/imageformats/avif.cpp
@@ -42,6 +42,11 @@ bool QAVIFHandler::canRead() const
 
     if (m_parseState != ParseAvifError) {
         setFormat("avif");
+
+        if (m_parseState == ParseAvifSuccess && m_decoder->imageIndex >= m_decoder->imageCount - 1) {
+            return false;
+        }
+
         return true;
     }
     return false;
-- 
GitLab