Skip to content

Commit

Permalink
fixes segfault [d4ba38d00d06ebba]: only main interpreter used as defa…
Browse files Browse the repository at this point in the history
…ult thread interpreter (stored in its TSD)
  • Loading branch information
sebres committed Nov 13, 2024
1 parent 5a65e5e commit b85082a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion generic/threadCmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,17 @@ Init(
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

if (tsdPtr->interp == NULL) {
Tcl_Interp *tmpInterp, *mainInterp = interp;
memset(tsdPtr, 0, sizeof(ThreadSpecificData));
tsdPtr->interp = interp;
/*
* Retrieve main interpreter of the thread, only
* main interpreter used as default thread-interpreter,
* so no childs here, see bug [d4ba38d00d06ebba]
*/
while (mainInterp && (tmpInterp = Tcl_GetMaster(mainInterp))) {
mainInterp = tmpInterp;
}
tsdPtr->interp = mainInterp;
ListUpdate(tsdPtr);
Tcl_CreateThreadExitHandler(ThreadExitProc,
threadEmptyResult);
Expand Down

0 comments on commit b85082a

Please sign in to comment.