]> git.ipfire.org Git - thirdparty/gcc.git/commit
libphobos: Don't call free on the TLS array in the emutls destroy function.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 26 Apr 2022 13:10:09 +0000 (14:10 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Tue, 26 Apr 2022 13:34:15 +0000 (14:34 +0100)
commit0bb57657f20b9b2d9b43b8e1d0748bd6367177f2
treee56c8db850949b2a87baa13b58b79c74e2a31c3d
parent84c86d3df27c8cabc6397b6ec710b35dfc24c40c
libphobos: Don't call free on the TLS array in the emutls destroy function.

Fixes a segfault seen on Darwin when a GC scan is ran after a thread has
been destroyed.  As the global emutlsArrays hash still has a reference
to the array itself, and tries to iterate all elements.

Setting the length to zero frees all allocated elements in the array,
and ensures that it is skipped when the _d_emutls_scan is called.

libphobos/ChangeLog:

* libdruntime/gcc/emutls.d (emutlsDestroyThread): Clear the per-thread
TLS array, don't call free().

(cherry picked from commit 796b7cbac3d553a91d37c3961b9391fb7e19d0c6)
libphobos/libdruntime/gcc/emutls.d