Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-07-11
06:27 • Closed ticket [439941ffff]: RememberSyncObject() loses the heap plus 3 other... artifact: 8678433431 user: davygrvy
06:27 • Ticket [439941ffff]: 4 changes artifact: 49d4c205c8 user: davygrvy
2001-07-10
03:54 • New ticket [439941ffff]. artifact: 47703fd091 user: davygrvy

RememberSyncObject() loses the heap

Closed / Invalid439941ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-07-10 03:54:20
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().
davygrvyplain2001-07-11 06:27:02
Logged In: YES 
user_id=7549

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

My mistake :)
davygrvy Closed ticket [439941ffff]. [History diff]2001-07-11 06:27:37
Log in (anonymous is fine) to add a comment.