When a Tk geometry manager reconfigures its
slaves, almost anything can happen via event
bindings, including deleting the manager widget or
slaves. The Tk pack and grid managers carefully
handle this, through a combination of
Tcl_Preserve/Tcl_Release and an abort flag. The
corresponding code is missing from the place
manager.
With Tcl/Tk 8.4.15 I was seeing crashes while using
place in mega-widget construction, in complex
timing-relating circumstances. I have since
produced a (very) contrived simple example, in
placer.tcl. Run it with wish. Using Tcl/Tk
8.4.15 resizing the main window crashes wish every
time on my Solaris unix build, and on a Windows-XP
single-threaded build. Memory corruption - so
your mileage may vary for different builds.
I have applied exactly the same protection method
as used in grid and pack to the placer. This
solve the problem in placer.tcl, and in my real
application. The Tcl/Tk 8.4 updated code applied
to CVS 1.13.2.1 is in tkPlace.c.84. I have also
updated the Tcl/Tk 8.5 code from CVS 1.22, in
tkPlace.c.85.
problem demo
Tcl/Tk 8.4 update to CVS 1.13.2.1
Logged In: YES
user_id=883691
Originator: YES
File Added: tkPlace.c.84
Tcl/Tk 8.5 update to CVS 1.22
Logged In: YES
user_id=883691
Originator: YES
File Added: tkPlace.c.85
Logged In: YES
user_id=80530
Originator: NO
I just tried the submitted replacement
tkPlace.c on the Tk HEAD. It does not
prevent the crash. The demo script
provided crashes on the Tk HEAD both
before and after the submitted fix
is attempted.
Better news is that the fix for
core-8-4-branch *does* appear to
be effective.
Logged In: YES
user_id=80530
Originator: NO
I must report pilot error
on the HEAD testing. Seems
my test was loading an
installed libtk.so, and not
the patched version. Submitted
fix is effective on both branches.
I'm committing these patches.
If later maintainer review indicates
the submitted code is not acceptable,
it can be revised, but for now
a crash-stopper is a crash-stopper.
Logged In: YES
user_id=80530
Originator: NO
fixes committed.