|
2019-06-21
| ||
| 19:26 | • Closed ticket [f8a33ce3db]: Tcl_Exit segfaults in application without initialize... artifact: a61946f185 user: sebres | |
| 19:22 | closes [f8a33ce3db5d8cc2]: Tcl_Exit uses system exit as fallback if Tcl-subsystems are not (yet) ini... check-in: 6c48a3be6d user: sebres tags: core-8-6-branch | |
| 19:10 | • New ticket [f8a33ce3db] Tcl_Exit segfaults in application without initialized tc... artifact: 8233aa6117 user: sebres | |
Tcl_Exit segfaults in application without initialized tcl-subsystems
The issue:
Calling of Tcl_Exit from main before Tcl being initialized causes a segfault.
The segfault occurs currently due to missing properly initialized Tcl-subsystems, at several places (no encoding by converting from external in get env-variable TCL_FINALIZE_ON_EXIT, no master TSD calling TCL_TSD_INIT, etc).
The solution for "unfixed" version:
int main( int argc, char* argv[] ) {
...
+ Tcl_FindExecutable(argv[0]);
...
Tcl_Exit(1);
...
}
Although I'm not sure, that this can be considered as a bug, I'll fix it, because the call of Tcl_FindExecutable is not really expected for proper exit, the program may use some common code where it then should destinguish between exit/Tcl_Exit (as well as to know, the Tcl got initialized or not), Tcl exit proc could be set (via Tcl_SetExitProc), etc.
And because the fix looks pretty easy (I found an easy-fix for that).
Fixed in [6c48a3be6d], this closed.