diff options
author | fvogel <fvogelnew1@free.fr> | 2017-06-30 20:26:05 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2017-06-30 20:26:05 (GMT) |
commit | 1abfb9b8018c02a8fa7623e6e54adf4266a70375 (patch) | |
tree | 7a5214be9ae8d39cfc5f2eb612febcb4d58b3632 | |
parent | 310e8e51335f9c6530bde45a82735fa8d1cb9d4e (diff) | |
parent | 84ef069edd615d0e09b0be93b26b9d9a0e6545fa (diff) | |
download | tk-1abfb9b8018c02a8fa7623e6e54adf4266a70375.zip tk-1abfb9b8018c02a8fa7623e6e54adf4266a70375.tar.gz tk-1abfb9b8018c02a8fa7623e6e54adf4266a70375.tar.bz2 |
Fix [62c5b7a1d7]: [text] segfaults on replace. Patch from Christian Werner.
-rw-r--r-- | generic/tkText.c | 1 | ||||
-rw-r--r-- | tests/text.test | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index 6ff1db9..e0dcc50 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1491,6 +1491,7 @@ TextWidgetObjCmd( * Move the insertion position to the correct place. */ + indexFromPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]); TkTextIndexForwChars(NULL, indexFromPtr, deleteInsertOffset, &index, COUNT_INDICES); TkBTreeUnlinkSegment(textPtr->insertMarkPtr, diff --git a/tests/text.test b/tests/text.test index edd2a6e..42b6114 100644 --- a/tests/text.test +++ b/tests/text.test @@ -1577,6 +1577,16 @@ test text-8.26 {TextWidgetCmd procedure, "replace" option crash} -setup { } -cleanup { destroy .tt } -result {} +test text-8.27 {TextWidgetCmd procedure, "replace" option crash} -setup { + text .tt +} -body { + .tt insert 0.0 \na + for {set i 0} {$i < 2} {incr i} { + .tt replace 2.0 3.0 b + } +} -cleanup { + destroy .tt +} -result {} test text-9.1 {TextWidgetCmd procedure, "get" option} -setup { |