This is a somewhat obscure and intermitted crash,
demonstrated by the attached script which requires
Bryan Oakley's combobox implementation (demonstrated
with version 2.2.1). An access violation occurs when
WmProc() in tkWinWm.c gets called with a WM_ACTIVATEAPP
event. This isn't in the switch so it goes on to get
winPtr = GetTopLevel(hwnd);
Unfortunately, the value sometimes comes up bogus
(filled with bad pointers and such) and when it
subsequently calls Tk_GetHWND(winPtr), it crashes from
winPtr->window being a bad pointer when attempting to
After lots of experimentation, I was able to cause the
crash with a straight wish running the script (as
opposed to the extended wish plus other Tcl code for my
application, which originally seemed partly involved
due to the intermittent nature of the crash) .
For convenience I've made the buttons take up the huge
area of the main toplevel (.), but that doesn't matter
for demonstrating the crash -- it just keeps you from
having to move the mouse around a bunch. The crash
does, however, seem to involve some of the geometry
operations going on to center and size the various
windows, combined with the combobox and the window
icon. Commenting out any one of these *seems* to stop
the crash from happening, but since it's intermittent
it is hard to be sure. In case it matters, I'm also
attaching the icon I'm using.
To demonstrate, after launching the script, click the
button that says "Combo". A new toplevel will be
created, centered on the screen, with a combobox in it.
Close the window (click the [X] icon). It seems to
occur more often if you repeat this (click the "Combo"
button, close the window that pops up) a couple times.
Then click exit. Often, but not always, this will
crash (with an invalid page fault or an access
violation depending on whether or not
you're running wish from within DevStudio). After
rebuilding wish with debugging symbols and running from
DevStudio I was able to track the crash to the WmProc()