diff options
author | vincentdarley <vincentdarley> | 2005-07-18 22:11:59 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2005-07-18 22:11:59 (GMT) |
commit | 3c996e73d6bb73987fb0111bfd20040fb7cc6715 (patch) | |
tree | bbe4da957a89759d8e5e54a83251d82987a132c8 | |
parent | a2b4a75e74b95eaea3e881761f6c79ee0ad2d12a (diff) | |
download | tk-3c996e73d6bb73987fb0111bfd20040fb7cc6715.zip tk-3c996e73d6bb73987fb0111bfd20040fb7cc6715.tar.gz tk-3c996e73d6bb73987fb0111bfd20040fb7cc6715.tar.bz2 |
fix to text widget 'mark prev' segfault
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tkTextMark.c | 4 | ||||
-rw-r--r-- | tests/textIndex.test | 12 | ||||
-rw-r--r-- | tests/textWind.test | 7 |
4 files changed, 25 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2005-07-18 Vince Darley <vincentdarley@users.sourceforge.net> + + * generic/tkTextMark.c: fix to segfault in "mark prev" + * tests/textIndex.test: [Bug 1240221] + + * tests/textWind.test: make test more robust to avoid infinite loop + 2005-07-06 Jeff Hobbs <jeffh@ActiveState.com> * doc/getOpenFile.n: correct -multiple docs (takes boolean) diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index 234ccd7..0c56b4a 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.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: tkTextMark.c,v 1.13 2004/10/05 01:26:10 hobbs Exp $ + * RCS: @(#) $Id: tkTextMark.c,v 1.14 2005/07/18 22:12:05 vincentdarley Exp $ */ #include "tkInt.h" @@ -883,7 +883,7 @@ MarkFindPrev(interp, textPtr, string) Tcl_SetResult(interp, "current", TCL_STATIC); } else if (prevPtr == textPtr->insertMarkPtr) { Tcl_SetResult(interp, "insert", TCL_STATIC); - } else if (segPtr->body.mark.textPtr != textPtr) { + } else if (prevPtr->body.mark.textPtr != textPtr) { /* Ignore widget-specific marks for the other widgets */ continue; } else { diff --git a/tests/textIndex.test b/tests/textIndex.test index 0f8f4c0..1546973 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textIndex.test,v 1.17 2005/05/13 13:47:18 vincentdarley Exp $ +# RCS: @(#) $Id: textIndex.test,v 1.18 2005/07/18 22:12:05 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -897,6 +897,16 @@ test textIndex-23.1 {text paragraph start} { set res } {2.0 1.1 1.1} +test textIndex-24.1 {text mark prev} { + pack [text .t2] + .t2 insert end [string repeat "1 2 3 4 5 6 7 8 9 0\n" 12] + .t2 mark set 1.0 10.0 + update + # then this crash Tk: + set res [.t2 mark previous 10.10] + destroy .t2 + set res +} {1.0} # cleanup rename textimage {} diff --git a/tests/textWind.test b/tests/textWind.test index 0fbd84f..2ca05cb2 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textWind.test,v 1.19 2004/12/04 00:04:42 dkf Exp $ +# RCS: @(#) $Id: textWind.test,v 1.20 2005/07/18 22:12:11 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -451,7 +451,10 @@ test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} {textf frame .t.f.f -width 10 -height 20 -bg $color } set msg {} - while {[llength $msg] < 2} {update ; .t bbox 1.5 ; after 10} + set count 0 + while {([llength $msg] < 2) && ($count < 100)} { + update ; incr count; .t bbox 1.5 ; after 10 + } lappend msg [.t bbox 1.5] [winfo exists .t.f.f] } [list {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} [list 40 [expr {11+$fixedDiff/2}] 0 0] 1] test textWind-10.4.1 {EmbWinLayoutProc procedure, error in creating window} {textfonts} { |