Menu

#1544 RememberSyncObject() loses the heap

obsolete: 8.4a3
closed-invalid
nobody
5
2001-07-10
2001-07-10
No

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().

Discussion

  • David Gravereaux

    Logged In: YES
    user_id=7549

    Please mark this invalid. It was fixed March 30th: Patch
    #403532, Bug #219391

    My mistake :)

     
  • David Gravereaux

    • status: open --> closed-invalid