Skip to content

Commit eb7e309

Browse files
committed
handle destruction of unattached threads
1 parent 73c0f1d commit eb7e309

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/coreclr/vm/ceemain.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,13 @@ void OsDetachThread(void* thread)
18151815
ASSERT(g_flsIndex != FLS_OUT_OF_INDEXES);
18161816
void* threadFromCurrentFiber = FlsGetValue(g_flsIndex);
18171817

1818+
if (threadFromCurrentFiber == NULL)
1819+
{
1820+
// thread was never attached.
1821+
_ASSERTE(flsState == FLS_STATE_CLEAR);
1822+
return;
1823+
}
1824+
18181825
if (threadFromCurrentFiber != thread)
18191826
{
18201827
_ASSERTE_ALL_BUILDS(!"Detaching a thread from the wrong fiber");

0 commit comments

Comments
 (0)