Tk Source Code

View Ticket
Login
Ticket UUID: 620808
Title: wish crashes after "destroy .toplevel"
Type: Bug Version: obsolete: 8.4.1
Submitter: nobody Created on: 2002-10-09 14:56:23
Subsystem: 67. Unix Window Operations Assigned To: mdejong
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2002-11-14 04:02:31
Resolution: Duplicate Closed By: mdejong
    Closed on: 2002-11-13 21:02:31
Description:
Following script crashes wish (press 'Exit' button):
---
wm withdraw .
toplevel .t
pack [frame .t.f]
pack [button .t.f.b -text Exit -command {destroy .t}]
bind .t <Destroy> exit
---

Environment:
Linux 2.4.18, glibc 2.2.5, XFree86 4.2.0.
Tcl: ActiveTcl8.4.0.1

Message:
Segmentation fault
User Comments: mdejong added on 2002-11-14 04:02:31:
Logged In: YES 
user_id=90858

Closing as dup of 630533, a working patch is posted there.

mdejong added on 2002-11-09 07:02:42:
Logged In: YES 
user_id=90858

Please take a look at the double destroy patch I attached to bug
630533. I think it should solve the problem, but I would feel
a lot better if it got some testing before being applied.

jenglish added on 2002-10-31 03:23:52:
Logged In: YES 
user_id=68433

See also Tk Bug #630533 "TkpCloseDisplay panic"; possible
fix posted there.

jenglish added on 2002-10-12 04:53:33:
Logged In: YES 
user_id=68433

Yipes!

Here's the valgrind report: (this is against Tcl/Tk 8.4):

==5663== Invalid write of size 4
==5663==    at 0x403F7FE4: (within
/usr/X11R6/lib/libX11.so.6.2)
==5663==    by 0x4028F36F: TkpCloseDisplay (in
/usr/local/lib/libtk8.4.so)
==5663==    by 0x4028941F: TkCloseDisplay (in
/usr/local/lib/libtk8.4.so)
==5663==    by 0x4028B51D: DeleteWindowsExitProc (in
/usr/local/lib/libtk8.4.so)
==5663==    Address 0x431082B0 is 4 bytes inside a block of
size 340 free'd
==5663==    at 0x40047766: free
(/home/cyrille/Code/2002/packages/my-packages/valgrind-1.0.3/vg_clientfuncs.c:180) 
==5663==    by 0x404203F8: (within
/usr/X11R6/lib/libX11.so.6.2)
==5663==    by 0x403F7FD8: (within
/usr/X11R6/lib/libX11.so.6.2)
==5663==    by 0x4028F36F: TkpCloseDisplay (in
/usr/local/lib/libtk8.4.so)
==5663== 
==5663== Invalid read of size 4
==5663==    at 0x403F7FEB: (within
/usr/X11R6/lib/libX11.so.6.2)
==5663==    by 0x4028F36F: TkpCloseDisplay (in
/usr/local/lib/libtk8.4.so)
==5663==    by 0x4028941F: TkCloseDisplay (in
/usr/local/lib/libtk8.4.so)
==5663==    by 0x4028B51D: DeleteWindowsExitProc (in
/usr/local/lib/libtk8.4.so)
==5663==    Address 0x431082B4 is 8 bytes inside a block of
size 340 free'd
==5663==    at 0x40047766: free
(/home/cyrille/Code/2002/packages/my-packages/valgrind-1.0.3/vg_clientfuncs.c:180)
==5663==    by 0x404203F8: (within
/usr/X11R6/lib/libX11.so.6.2)
==5663==    by 0x403F7FD8: (within
/usr/X11R6/lib/libX11.so.6.2)
==5663==    by 0x4028F36F: TkpCloseDisplay (in
/usr/local/lib/libtk8.4.so)
==5663== 

So it looks like something in libX11 is stomping on memory
that it freed.

This would have to be  XFreeFontSet(), XCloseIM(), XSync(),
or XCloseDisplay(), since those are the only libX11 routines
called
by TkpCloseDisplay().  And sure enough, there's a note in
the source
that XCloseIM() is buggy on some systems.

I have no idea where to proceed from here.  Judging from the
CVS
logs, Mo is already familiar with this problem; reassigning
to him.

dgp added on 2002-10-10 21:30:19:
Logged In: YES 
user_id=80530

candidate for 8.4.1 fix ?

dgp added on 2002-10-10 02:26:16:
Logged In: YES 
user_id=80530

Submitted script triggers panic()
on line 198 of tkUnixEvent.c