Artifacts Associated With Ticket 217981
Ticket change [c70e68e239] (rid 121874) by nobody on 2000-10-26 00:47:07:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 5793 Bug Version: 8.4a1 SubmitDate: '2000-06-02' LastModified: '2000-07-19' Severity: MED Status: Closed Submitter: techsupp ChangedBy: davidg RelatedBugIDs: 5829 OS: Windows NT FixedDate: '2000-07-19' ClosedDate: '2000-10-25' Name: David Gravereaux CVS: updated today Comments: This isn't working yet, but the idea for how to do it might be for you core guys. At least it's a good starting point. Maybe I'll run this in the debugger tomorrow and look for good ways to unblock tclsh from it's infinite GetConsole wait so I can post a Tcl_Eval(..., "::exit"); just my $0.02 ObservedBehavior: control-c causes tclsh84 (built for threads) to crash rather than exit cleanly. Patch: *** tclAppInit.c1999/12/02 02:03:371.6 --- tclAppInit.c2000/06/02 08:26:32 *************** *** 29,35 **** --- 29,39 ---- #endif /* TCL_TEST */ static voidsetargv _ANSI_ARGS_((int *argcPtr, char ***argvPtr)); + static BOOL __stdcallCtrlHandler _ANSI_ARGS_((DWORD fdwCtrlType)); + Tcl_AsyncHandlerexitToken; + Tcl_AsyncProcasyncExit; + /* *---------------------------------------------------------------------- *************** *** 156,161 **** --- 160,168 ---- Procbodytest_SafeInit); #endif /* TCL_TEST */ + SetConsoleCtrlHandler(CtrlHandler, TRUE); + exitToken = Tcl_AsyncCreate(asyncExit, (ClientData) interp); + /* * Call the init procedures for included packages. Each call should * look like this: *************** *** 298,301 **** --- 305,356 ---- *argcPtr = argc; *argvPtr = argv; + } + + /* + *---------------------------------------------------------------------- + * + * asyncExit -- + * + *The AsyncProc for the exitToken. + * + * Results: + *doesn't actually return. + * + * Side effects: + *tclsh cleanly exits. + * + *---------------------------------------------------------------------- + */ + + int asyncExit (ClientData clientData, Tcl_Interp *interp, int code) + { + char *cmd = "::exit"; + + Tcl_Eval((Tcl_Interp *) clientData, cmd); + return code; + } + + /* + *---------------------------------------------------------------------- + * + * CtrlHandler -- + * + *Signal handler for the Win32 OS. Catches Ctrl+C, Ctrl+break and + *other exits. This is needed so tclsh can do it's real clean-up + *and not an unclean crash terminate. + * + * Results: + *True to notify the OS we'll handle this ourselves. + * + * Side effects: + *effects the way the app exits from a signal. + * + *---------------------------------------------------------------------- + */ + + BOOL __stdcall CtrlHandler (DWORD fdwCtrlType) + { + Tcl_AsyncMark(exitToken); + return TRUE; } PatchFiles: tclAppInit.c see 5829 -- 07/19/2000 davidg - foundin initialized to: "obsolete: 8.4a1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "49. Threading"
- title initialized to: "fix proposal for TR#5312"
- type initialized to: "Bug"
Ticket change [7be45a5d71] (rid 96981) by welch on 2000-10-26 08:12:09:
- closedate changed to: "2000-10-26T01:12:09"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"