Menu

#2017 image item with activeimage and bind to destory - drag crash

obsolete: 8.4.12
open
5
2006-02-05
2006-02-05
No

If you create an image item in a canvas that contains
an activeimage, then you bind it so that it is
destroyed when you click it. It is fine if you just
click on it (it will be destroyed) but if you click and
drag off it then it will cause a crash.

Here is a very short test app that shows this note you
need to have an image in the same folder, any image
should do (either name it close.gif, or change the link
in the code). If you click on the image it destroys it,
if you click on the image and drag off it - crash:

pack [canvas .c]
set i [image create photo -file close.gif]
.c create image 20 20 -anchor nw -image $i -activeimage
$i -tag c1text
.c bind c1text <ButtonRelease-1> "destroy .c"

#note, you can get around the bug by replacing either
(or both) of the last 2 lines with these:
#.c create image 20 20 -anchor nw -image $i -tag c1text
#.c bind c1text <ButtonRelease-1> "after 0 \"destroy .c\""

Just to note I ran this under windows using the
binaries from Activestate under Tcl/Tk 8.4.11, however
I got a friend to test it under linux 8.4.11 and 8.4.12
and he said that it causes a crash under both cause, he
also was able to give me the callstack (not sure if it
was for 8.4.11 or 8.4.12) although it is pretty
intuitive what this crash is probably caused by...
Program received signal SIGSEGV, Segmentation fault.
0x005ba93c in Tk_CanvasEventuallyRedraw () from
/usr/lib/libtk8.4.so
(gdb) bt
#0 0x005ba93c in Tk_CanvasEventuallyRedraw () from
/usr/lib/libtk8.4.so
#1 0x005bc860 in Tk_CreateItemType () from
/usr/lib/libtk8.4.so
#2 0x005bd06e in Tk_CreateItemType () from
/usr/lib/libtk8.4.so
#3 0x00581766 in Tk_HandleEvent () from
/usr/lib/libtk8.4.so
#4 0x00581c44 in Tk_HandleEvent () from
/usr/lib/libtk8.4.so
#5 0x001dc3f3 in Tcl_ServiceEvent () from
/usr/lib/libtcl8.4.so
#6 0x001dc68f in Tcl_DoOneEvent () from
/usr/lib/libtcl8.4.so
#7 0x00581088 in Tk_MainLoop () from /usr/lib/libtk8.4.so
#8 0x0058e9f7 in Tk_MainEx () from /usr/lib/libtk8.4.so
#9 0x080487e4 in main ()

Discussion

MongoDB Logo MongoDB