diff options
author | fvogel <fvogelnew1@free.fr> | 2012-01-31 22:24:11 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2012-01-31 22:24:11 (GMT) |
commit | 7664c99658c07b63bcdfc3827dd74d8da19ef1fd (patch) | |
tree | 1f9ca7098989620146558e0736d079e2bad9d81f /generic/tkTextDisp.c | |
parent | b4f5df095c7b84b7aa277daf88a07e38f6e03abc (diff) | |
download | tk-7664c99658c07b63bcdfc3827dd74d8da19ef1fd.zip tk-7664c99658c07b63bcdfc3827dd74d8da19ef1fd.tar.gz tk-7664c99658c07b63bcdfc3827dd74d8da19ef1fd.tar.bz2 |
[Bug-1630262]: segfault when deleting lines with peer text widgets
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r-- | generic/tkTextDisp.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 5f30b11..f674b75 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3219,6 +3219,34 @@ TextInvalidateLineMetrics( int fromLine; TextDInfo *dInfoPtr = textPtr->dInfoPtr; + /* + * All lines to invalidate must be inside the -startline/-endline range. + */ + + if (linePtr != NULL) { + int start; + TkTextLine *toLinePtr; + if (textPtr->start != NULL) { + fromLine = TkBTreeLinesTo(NULL, linePtr); + start = TkBTreeLinesTo(NULL, textPtr->start); + if (fromLine < start) { + lineCount -= start - fromLine; + linePtr = textPtr->start; + } + } + if (textPtr->end != NULL) { + int count = 0; + toLinePtr = linePtr; + while (count < lineCount && toLinePtr != NULL) { + toLinePtr = TkBTreeNextLine(textPtr, toLinePtr); + count++; + } + if (toLinePtr == NULL) { + lineCount = count; + } + } + } + if (linePtr != NULL) { int counter = lineCount; @@ -3229,7 +3257,7 @@ TextInvalidateLineMetrics( */ TkBTreeLinePixelEpoch(textPtr, linePtr) = 0; - while (counter > 0 && linePtr != 0) { + while (counter > 0 && linePtr != NULL) { linePtr = TkBTreeNextLine(textPtr, linePtr); if (linePtr != NULL) { TkBTreeLinePixelEpoch(textPtr, linePtr) = 0; @@ -3244,7 +3272,7 @@ TextInvalidateLineMetrics( * more lines than is strictly necessary (but the examination of the * extra lines should be quick, since their pixelCalculationEpoch will * be up to date). However, to keep track of that would require more - * complex record-keeping that what we have. + * complex record-keeping than what we have. */ if (dInfoPtr->lineUpdateTimer == NULL) { |