Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 47703fd091eb8e9e83ab77853b009957c6b825e0
Ticket: 439941ffffffffffffffffffffffffffffffffff
RememberSyncObject() loses the heap
User & Date: davygrvy on 2001-07-10 03:54:20
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    WinNT-5.
    
    Embedding Tcl into a windows GUI application has a 
    problem with Tcl_Exit().  Tcl_Finalize() is called 
    twice.  Once in Tcl_Exit() and a second time during 
    the unloading of tcl84.dll from its DllMain().  In the 
    second call to Tcl_Finalize(), TclpInitLock() tries to 
    add a new syncobject to keyRecord.list[], but the 
    allocation of that once valid memory location has 
    disappeared causing the "Invalid memory access" 
    dialogbox of death to popup.
    
    I don't have a clear solution to this problem at this 
    time.  I would prefer a different codepath for my own 
    exit, but I don't see a direct way of setting one, 
    like how you can set an app-specific Tcl_PanicProc.  A 
    Tcl_SetExitProc() would be a handy API to add.  I 
    would use it!  I know for a fact, if I can post a 
    WM_CLOSE to the GUI, everything comes down fine.  I 
    would prefer not to use ExitProccess() [that's what 
    exit() from msvcrt is doing on the inside, btw].
    
    I guess I could write an extension command for 
    [exit]...  Is it a valid concern about it getting it 
    rename'd at the Tcl level and break what I'm trying to 
    fix?
    
    int
    MyExit(ClientData c, Tcl_Interp *i, int obj c....)
    {
        PostMessage(mainHWnd, WM_CLOSE, 0, 0);
        return TCL_OK;
    }
    Tcl_CreateObjCommand(interp, "::exit", MyExit, 0L, 0L);
    
    Will that work Ok or do parts of the core call Tcl_Exit
    () directly?  I must be able to have the current 
    interpreter execution unwind fully so I can delete 
    that interpreter, but to do it, I'll have to have 
    [exit] return to unwind the current Tcl_Eval().
    
  4. foundin changed to: "obsolete: 8.4a3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "davygrvy"
  9. subsystem changed to: "50. Embedding Support"
  10. title changed to: "RememberSyncObject() loses the heap"
  11. type changed to: "Bug"