Bug 461257

Summary: Digikam crashes when displaying thumbnails for JP2 files
Product: [Applications] digikam Reporter: stephen.r.thomas <stephen.r.thomas>
Component: Plugin-DImg-JP2KAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, metzpinguin, stephen.r.thomas
Priority: NOR    
Version First Reported In: 7.8.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 7.9.0
Sentry Crash Report:
Attachments: Windows pop-ups displayed immediately prior to crash

Description stephen.r.thomas@gmail.com 2022-10-31 17:45:37 UTC
Created attachment 153360 [details]
Windows pop-ups displayed immediately prior to crash

SUMMARY
When opening a folder containing JP2 files, digikam crashes repeatably when trying to display the thumbnails. 2 Windows pop-ups are displayed just before crashing - see attached file errors.jpg. I just upgraded from V7.2.0, where this worked OK.

STEPS TO REPRODUCE
1.   Place a few JP2s in a folder, then open the folder.
2. 
3. 

OBSERVED RESULT
Crash

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows:  V10

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2022-10-31 18:51:46 UTC
A first short test shows no problems with digiKam-7.9.0 on Windows 10 and JP2 files.
Can you please provide a file to reproduce the problem.

Maik
Comment 2 Maik Qualmann 2022-10-31 22:06:25 UTC
OK, problem is clear. Libjasper needs to be ported to API > 3. jas_init_library() and jas_init_thread() must not be called twice in the same thread (if 2 images or more are loaded at the same time).

Maik
Comment 3 stephen.r.thomas@gmail.com 2022-11-01 10:19:16 UTC
Ok thanks for that!

Regards,

Steve T

On 31/10/2022 22:06, Maik Qualmann wrote:
> https://bugs.kde.org/show_bug.cgi?id=461257
>
> Maik Qualmann <metzpinguin@gmail.com> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>       Ever confirmed|0                           |1
>               Status|REPORTED                    |CONFIRMED
>
> --- Comment #2 from Maik Qualmann <metzpinguin@gmail.com> ---
> OK, problem is clear. Libjasper needs to be ported to API > 3.
> jas_init_library() and jas_init_thread() must not be called twice in the same
> thread (if 2 images or more are loaded at the same time).
>
> Maik
>
Comment 4 Maik Qualmann 2022-11-01 18:28:23 UTC
Git commit 87a2a0105c291f1f45c4b0e8d061b09561de269d by Maik Qualmann.
Committed on 01/11/2022 at 18:27.
Pushed by mqualmann into branch 'master'.

port JPEG2000 loader to use libjasper 3.x.x
With libjasper thread support.

M  +126  -1    core/dplugins/dimg/jpeg2000/dimgjpeg2000loader_load.cpp
M  +74   -1    core/dplugins/dimg/jpeg2000/dimgjpeg2000loader_save.cpp
M  +76   -1    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.cpp
M  +5    -0    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h

https://invent.kde.org/graphics/digikam/commit/87a2a0105c291f1f45c4b0e8d061b09561de269d
Comment 5 Maik Qualmann 2022-11-01 18:29:40 UTC
The patch is currently only applied to digiKam-8.0.0. I'm still checking whether we can still use it on digiKam-7.9.0.

Maik
Comment 6 Maik Qualmann 2022-11-01 19:20:30 UTC
Git commit 2058d35c984e679d2c3e553fbe9cbdb8734bc069 by Maik Qualmann.
Committed on 01/11/2022 at 19:19.
Pushed by mqualmann into branch 'qt5-maintenance'.

sync with master
FIXED-IN: 7.9.0

M  +2    -1    NEWS
M  +124  -1    core/dplugins/dimg/jpeg2000/dimgjpeg2000loader_load.cpp
M  +71   -0    core/dplugins/dimg/jpeg2000/dimgjpeg2000loader_save.cpp
M  +76   -1    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.cpp
M  +6    -0    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h

https://invent.kde.org/graphics/digikam/commit/2058d35c984e679d2c3e553fbe9cbdb8734bc069