Bug 444875 - "Critical section not initialized" warning in lcms
Summary: "Critical section not initialized" warning in lcms
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL: https://github.com/mm2/Little-CMS/iss...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-03 10:37 UTC by Alvin Wong
Modified: 2022-01-29 10:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
warning and backtrace (5.29 KB, text/plain)
2021-11-03 10:37 UTC, Alvin Wong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Wong 2021-11-03 10:37:40 UTC
Created attachment 143166 [details]
warning and backtrace

Application Verifier gives this warning on starting Krita. I'm not sure how big of an issue this is.

(Nightly 5214230c5a)
Comment 1 Halla Rempt 2021-11-03 10:48:33 UTC
Looks like it's a bug in lcms, not in Krita.
Comment 2 Alvin Wong 2021-11-03 13:20:57 UTC
From lcms's code, the critical section is to be initialized in `cmsCreateContext` [1]. Looking at Krita's code however, this function is never called. If it is completely expected to not call this function, then it would seem that yes, it is an upstream issue.

Opened https://github.com/mm2/Little-CMS/issues/289

[1]: https://github.com/mm2/Little-CMS/blob/0b845e907e63129110e2ce5ee2e4476e7b6efd08/src/cmsplugin.c#L805

---

(Extra info:) There is also a note in `lcms2_internal.h` [2]:

> 1) [...]
> 
> 2) In cases where we want to work on pre-Windows XP, we
> can use an even more horrible hack described below.
> 
> So why wouldn't we always use 2)? Because not calling
> the init function for a critical section means it fails
> testing with ApplicationVerifier (and presumably similar
> tools).

But this is evidently not applicable here, because:

- `CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT` is unset, which means this hack isn't used.
- "Critical section debug info address" is 0 instead of (void *)-1, which validates the last point.

[2]: https://github.com/mm2/Little-CMS/blob/0b845e907e63129110e2ce5ee2e4476e7b6efd08/src/lcms2_internal.h#L211-L256
Comment 3 Halla Rempt 2021-11-03 13:48:12 UTC
Eh, now I'm really confused :-)
Comment 4 Alvin Wong 2022-01-06 17:48:52 UTC
Upstream made a fix for this. I'll test it next time we update the deps I guess.
Comment 5 Alvin Wong 2022-01-29 10:11:48 UTC
Verified fixed by lcms update https://invent.kde.org/graphics/krita/-/commit/a4bd7fd0e7175a58c63b88cdcfc93607c0d18f52