- refactor: Add LockStackItem type alias
- refactor: Add LockPair type alias
- refactor: Refactor duplicated code into LockHeld()
- Replace thread_local g_lockstack with a mutex-protected map
This change prevents UB in case of early g_lockstack destroying.
Co-authored-by: Wladimir J. van der Laan <laanwj@protonmail.com>
- doc: Add and fix comments about never destroyed objects
This is a backport of Core PR18881