diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2007-10-09 12:34:33 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2007-10-09 12:34:33 (GMT) |
commit | 88f37cabad4c7f19e6b6f94fa5dba33e2562f304 (patch) | |
tree | 6d78ff59b95ba245009f2fa1cdd59e8ac38fcbea | |
parent | 02101584875920a2df958fa6e171cf2cb74f73be (diff) | |
download | tk-88f37cabad4c7f19e6b6f94fa5dba33e2562f304.zip tk-88f37cabad4c7f19e6b6f94fa5dba33e2562f304.tar.gz tk-88f37cabad4c7f19e6b6f94fa5dba33e2562f304.tar.bz2 |
Make Ttk_GetImage safe if called with NULL interp. Added some tests
that crash on Windows without this fix.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tkImage.c | 6 | ||||
-rw-r--r-- | tests/ttk/image.test | 35 |
3 files changed, 44 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2007-10-09 Pat Thoyts <patthoyts@users.sourceforge.net> + + * generic/tkImage.c: Make Ttk_GetImage safe if called with NULL + * tests/ttk/image.test: interp. Added some tests that crash + on Windows without this fix. + 2007-10-02 Don Porter <dgp@users.sourceforge.net> * generic/tk.h: Bump version number to 8.5b1.1 to distinguish diff --git a/generic/tkImage.c b/generic/tkImage.c index 3688284..4beed34 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkImage.c,v 1.33 2007/09/07 00:34:52 dgp Exp $ + * RCS: @(#) $Id: tkImage.c,v 1.34 2007/10/09 12:34:34 patthoyts Exp $ */ #include "tkInt.h" @@ -574,7 +574,9 @@ Tk_GetImage( return (Tk_Image) imagePtr; noSuchImage: - Tcl_AppendResult(interp, "image \"", name, "\" doesn't exist", NULL); + if (interp) { + Tcl_AppendResult(interp, "image \"", name, "\" doesn't exist", NULL); + } return NULL; } diff --git a/tests/ttk/image.test b/tests/ttk/image.test index e9c1248..de2a65d 100644 --- a/tests/ttk/image.test +++ b/tests/ttk/image.test @@ -1,5 +1,5 @@ # -# $Id: image.test,v 1.2 2006/12/09 20:53:35 jenglish Exp $ +# $Id: image.test,v 1.3 2007/10/09 12:34:34 patthoyts Exp $ # package require Tk 8.5 @@ -17,5 +17,38 @@ test image-1.2 "Duplicate element" -setup { ttk::style element create testElement image test.element } -returnCodes 1 -result "Duplicate element testElement" +test image-2.0 "Deletion of displayed image (label)" -setup { + image create photo test.image -width 10 -height 10 +} -body { + pack [set w [ttk::label .ttk_image20 -image test.image]] + tkwait visibility $w + image delete test.image + update +} -cleanup { + destroy .ttk_image20 +} -result {} + +test image-2.1 "Deletion of displayed image (checkbutton)" -setup { + image create photo test.image -width 10 -height 10 +} -body { + pack [set w [ttk::checkbutton .ttk_image21 -image test.image]] + tkwait visibility $w + image delete test.image + update +} -cleanup { + destroy .ttk_image21 +} -result {} + +test image-2.2 "Deletion of displayed image (radiobutton)" -setup { + image create photo test.image -width 10 -height 10 +} -body { + pack [set w [ttk::radiobutton .ttk_image22 -image test.image]] + tkwait visibility $w + image delete test.image + update +} -cleanup { + destroy .ttk_image22 +} -result {} + # tcltest::cleanupTests |