From 94533b37310c2295093ae8d6f8849f99fd783c92 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 11 Mar 2010 09:29:29 +0000 Subject: * generic/tkText.c (DumpLine): [Bug 2968379]: When peers are about, there can be unnamed marks present during a dump. Ignore them as they will just be for the peers' insert and current marks, which aren't very important. --- ChangeLog | 7 +++++++ generic/tkText.c | 15 ++++++++++----- tests/text.test | 11 ++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5c6158..b6b25ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-03-11 Donal K. Fellows + + * generic/tkText.c (DumpLine): [Bug 2968379]: When peers are about, + there can be unnamed marks present during a dump. Ignore them as they + will just be for the peers' insert and current marks, which aren't + very important. + 2010-03-04 Donal K. Fellows * doc/clipboard.n: Added note about STRING vs. UTF8_STRING types. diff --git a/generic/tkText.c b/generic/tkText.c index c1be9d9..0bca141 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.79.2.6 2010/02/21 13:23:13 dkf Exp $ + * RCS: @(#) $Id: tkText.c,v 1.79.2.7 2010/03/11 09:29:29 dkf Exp $ */ #include "default.h" @@ -4694,14 +4694,19 @@ DumpLine( name = "insert"; } else if (segPtr == textPtr->currentMarkPtr) { name = "current"; + } else if (markPtr->hPtr == NULL) { + name = NULL; + lineChanged = 0; } else { name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, markPtr->hPtr); } - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, - lineno, offset, &index); - lineChanged = DumpSegment(textPtr, interp, "mark", name, - command, &index, what); + if (name != NULL) { + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, + lineno, offset, &index); + lineChanged = DumpSegment(textPtr, interp, "mark", name, + command, &index, what); + } } else if ((what & TK_DUMP_TAG) && (segPtr->typePtr == &tkTextToggleOnType)) { TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, diff --git a/tests/text.test b/tests/text.test index 2d8d916..771a309 100644 --- a/tests/text.test +++ b/tests/text.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: text.test,v 1.49.2.2 2009/10/22 21:41:20 dkf Exp $ +# RCS: @(#) $Id: text.test,v 1.49.2.3 2010/03/11 09:29:29 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -2936,6 +2936,15 @@ test text-22.26 {TextDumpCmd procedure, unicode characters} { .t insert 1.0 abc\xb1\xb1\xb1 .t dump -all 1.0 2.0 } "text abc\xb1\xb1\xb1 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6" +test text-22.27 {TextDumpCmd procedure, peer present} -setup { + destroy .t +} -body { + text .t + .t peer create .t.t + .t dump -all 1.0 end +} -cleanup { + destroy .t +} -result "mark insert 1.0 mark current 1.0 text {\n} 1.0" set l [interp hidden] deleteWindows -- cgit v0.12