Bug 457043 - Render GIF animation fails the first time after startup
Summary: Render GIF animation fails the first time after startup
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-07-23 11:04 UTC by Alvin Wong
Modified: 2022-08-04 17:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Wong 2022-07-23 11:04:05 UTC
SUMMARY

When rendering animation to GIF for the first time after opening Krita, only some of the frames are written and the render fails with: "Failed to render animation frames! Output files are incomplete." It works when you do it the second time.


STEPS TO REPRODUCE
1. Start Krita and open https://github.com/libjxl/conformance/raw/master/testcases/animation_newtons_cradle/input.jxl
2. Choose File -> Render Animation
3. Select video and set render as GIF image
4. Select OK

OBSERVED RESULT

Export fails with "Failed to render animation frames! Output files are incomplete."

EXPECTED RESULT

Export should succeed.

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
Tested with nightly 44e3597339
Comment 1 Eoin O'Neill 2022-08-04 00:04:09 UTC
This seems to be happening with the first export attempt in general after Krita's initial startup currently. For some reason, we're getting a erroneous "filetype not supported" error from the KisImportExportManager's filterForMimeType method until we run again.
Comment 2 Eoin O'Neill 2022-08-04 00:14:32 UTC
I found the source of the bug:

Something in commit 710e424a965d945ed2f91091f7aabcab431d3199 is causing the exporter to fail on the first export attempt. For now, I've assigned the bug to Dmitry since it was introduced in that commit. I was going to fix it myself, but since it's tied to Windows performance, I wanted to be doubly sure that this is fixed appropriately for the OS.
Comment 3 Dmitry Kazakov 2022-08-04 13:21:45 UTC
Git commit 8106e5c92af65d5d52304858a63e4d88e4f87b12 by Dmitry Kazakov.
Committed on 04/08/2022 at 12:59.
Pushed by dkazakov into branch 'master'.

Fix problem of rendering animation

Animation is rendered in multiple threads, the loaders cannot be
accessed in multiple threads though. So now there is a wrapper class
that locks the access to the library loading.

M  +3    -3    libs/flake/KoShapeFactoryBase.cpp
M  +34   -3    libs/koplugin/KoJsonTrader.cpp
M  +17   -1    libs/koplugin/KoJsonTrader.h
M  +17   -17   libs/koplugin/KoPluginLoader.cpp
M  +15   -12   libs/ui/KisImportExportManager.cpp
M  +4    -4    plugins/extensions/qmic/QMic.cpp

https://invent.kde.org/graphics/krita/commit/8106e5c92af65d5d52304858a63e4d88e4f87b12
Comment 4 Dmitry Kazakov 2022-08-04 13:22:25 UTC
Git commit 1f874f2da2cdf9c66647c0a7ed937f8321f35bc7 by Dmitry Kazakov.
Committed on 04/08/2022 at 13:22.
Pushed by dkazakov into branch 'krita/5.1'.

Fix problem of rendering animation

Animation is rendered in multiple threads, the loaders cannot be
accessed in multiple threads though. So now there is a wrapper class
that locks the access to the library loading.

M  +3    -3    libs/flake/KoShapeFactoryBase.cpp
M  +34   -3    libs/koplugin/KoJsonTrader.cpp
M  +17   -1    libs/koplugin/KoJsonTrader.h
M  +17   -17   libs/koplugin/KoPluginLoader.cpp
M  +15   -12   libs/ui/KisImportExportManager.cpp
M  +4    -4    plugins/extensions/qmic/QMic.cpp

https://invent.kde.org/graphics/krita/commit/1f874f2da2cdf9c66647c0a7ed937f8321f35bc7
Comment 5 amyspark 2022-08-04 15:59:10 UTC
Git commit c90e21774385eec3cbf28aa41c2261e1be52aaeb by L. E. Segovia.
Committed on 04/08/2022 at 15:20.
Pushed by lsegovia into branch 'master'.

MSVC: fix export of KoJsonTrader::Plugin

M  +1    -1    libs/koplugin/KoJsonTrader.h

https://invent.kde.org/graphics/krita/commit/c90e21774385eec3cbf28aa41c2261e1be52aaeb
Comment 6 Alvin Wong 2022-08-04 17:17:41 UTC
Git commit 3f4352e6aff894009f904cba90a363aeece9baf7 by Alvin Wong, on behalf of L. E. Segovia.
Committed on 04/08/2022 at 17:17.
Pushed by alvinwong into branch 'krita/5.1'.

MSVC: fix export of KoJsonTrader::Plugin


(cherry picked from commit c90e21774385eec3cbf28aa41c2261e1be52aaeb)

M  +1    -1    libs/koplugin/KoJsonTrader.h

https://invent.kde.org/graphics/krita/commit/3f4352e6aff894009f904cba90a363aeece9baf7