Skip to content

Commit 04c8df2

Browse files
IanButterworthKristofferC
authored andcommitted
fixup "Don't free regex objects in exit-time finalizer calls (#57834)"
1 parent 0cb75f3 commit 04c8df2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

base/regex.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ mutable struct Regex <: AbstractPattern
4040
re = compile(new(pattern, compile_options, match_options, C_NULL))
4141
finalizer(re) do re
4242
# don't free during exit because tasks may still be running and
43-
# using it. Issue #57817
44-
during_exit = Base._atexit_hooks_finished
43+
# using it. Issue #57817. During sysimage creation _atexit_hooks_finished
44+
# is not defined but threads aren't running so just always run
45+
during_exit = @isdefined(_atexit_hooks_finished) && _atexit_hooks_finished
4546
if re.regex != C_NULL && !during_exit
4647
PCRE.free_re(re.regex)
4748
end

0 commit comments

Comments
 (0)