Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.0
-
None
-
381f5ae82cccec3774b68674b4c0e782e9f49f6f
Description
Currently it is not possible to differentiate an infinite animation from a gif not being animated at all. The problem is within the documentation. It is not clear what should be returned for a infinite animation (the guess would be -1) and what should be returned for no animations (e.g 0?). The MNG plugin should be checked as well and then the documentation should be adjusted and the GIF plugin be fixed.
The problem is that in the QGifHandler the loopCnt is initialized to 0 and the loopCount implementation is doing loopCnt - 1; For infinite animations the loopCnt will be set to '0' and for the no animation loopCnt will never be set from within the decoding.
The proposed patch would be to initialize loopCnt with '1', change loopCount() to check the number of frames read and return -1 if nothing has been read and otherwise return loopCnt - 1;