Overview
| Artifact ID: | 759a07b5cb770e47d979994ca609d3c5575672fc |
|---|---|
| Ticket: | 858493ffffffffffffffffffffffffffffffffff
Win32: DllMain needs SEH around Tcl_Finalize() |
| User & Date: | davygrvy on 2003-12-11 20:03:31 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
If Tcl is being unloaded by the OS from Tcl_Panic's ExitProcess(), and Tcl_Panic was called from an __except block due to a crash, calling Tcl_Finalize is unsafe. IOW, DllMain should protect the call to Tcl_Finalize to ensure it won't throw an unhandled exception as we can't guarentee Tcl is always being unloaded from a stable condition. I found this experimenting with running Tcl from a __try block and calling Tcl_Panic in the __except handler: // enter Tcl's notifier and don't fall-out until the thread is // told to quit. // If a fatal exception happens, catch it and by setting the // async token to NULL, render QueueJob() non-functional. // __try { __try { while (!done) { // *ALL* of Tcl runs from this loop. Tcl_DoOneEvent (TCL_ALL_EVENTS); } Tcl_AsyncDelete(*token); Tcl_Finalize(); FreeLibrary(hTclMod); } __finally { *token = 0L; } } __except (EXCEPTION_EXECUTE_HANDLER) { .... Tcl_Panic("big crash"); } I couldn't place FreeLibrary in the __finally as it was causing exceptions itself from Tcl_Finalize in the DllMain. Yet, when my panicProc calls ExitProcess, the same thing happens. I added a change just yesterday to WishPanic() on the 84branch: __try { ExitProcess(EXIT_FAILURE); } __except (EXCEPTION_EXECUTE_HANDLER) { TerminateProcess(GetCurrentProcess(), EXIT_FAILURE); } but I think I need to back it out and address the problem here in Tcl. - foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "davygrvy"
- subsystem changed to: "None"
- title changed to: "DllMain needs SEH around Tcl_Finalize()"
- type changed to: "Patch"