Prevent early destruction of gFuns, fixes AddressSanitizer: heap-use-after-free (#22386)

Prevent destruction of gFuns before callClosures

(cherry picked from commit e0396900ed)
This commit is contained in:
norrath-hero-cn
2023-08-06 01:38:32 +08:00
committed by narimiran
parent fb2cc06557
commit 36b339bbcf

View File

@@ -22,7 +22,7 @@ type
var
gFunsLock: Lock
gFuns: seq[Fun]
gFuns {.cursor.}: seq[Fun] #Intentionally use the cursor to break up the lifetime trace and make it compatible with JS.
initLock(gFunsLock)