Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2000-10-26
08:12 • Closed ticket [217981ffff]: fix proposal for TR#5312 plus 4 other changes artifact: 7be45a5d71 user: welch
00:47 • New ticket [217981ffff]. artifact: c70e68e239 user: nobody

fix proposal for TR#5312

Closed / Fixed217981ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:47:07
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
welch Closed ticket [217981ffff]. [History diff]2000-10-26 08:12:09
Log in (anonymous is fine) to add a comment.