diff --git a/src/plugins/imageformats/mng/qmnghandler.cpp b/src/plugins/imageformats/mng/qmnghandler.cpp index 4a361abeb5d6b2cce4cab8b9879fcb4de20a75d1..d99ce43081d5804f7c0f50cc471e2e3e4f0a4778 100644 --- a/src/plugins/imageformats/mng/qmnghandler.cpp +++ b/src/plugins/imageformats/mng/qmnghandler.cpp @@ -263,6 +263,7 @@ mng_bool QMngHandlerPrivate::processHeader(mng_uint32 iWidth, mng_uint32 iHeight bool QMngHandlerPrivate::getNextImage(QImage *result) { mng_retcode ret; + const bool savedHaveReadAll = haveReadAll; if (haveReadNone) { haveReadNone = false; ret = mng_readdisplay(hMNG); @@ -271,6 +272,13 @@ bool QMngHandlerPrivate::getNextImage(QImage *result) } if ((MNG_NOERROR == ret) || (MNG_NEEDTIMERWAIT == ret)) { *result = image; + + // QTBUG-28894 -- libmng produces an extra frame at the end + // of the animation on the first loop only. + if (nextDelay == 1 && (!savedHaveReadAll && haveReadAll)) { + ret = mng_display_resume(hMNG); + } + frameIndex = nextIndex++; if (haveReadAll && (frameCount == 0)) frameCount = nextIndex;