summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordas <das>2007-10-12 03:06:08 (GMT)
committerdas <das>2007-10-12 03:06:08 (GMT)
commit7e3535dff93c2665d3f6f513bb5e68c5125aa717 (patch)
treea9665b8b2f69c880170abbfa5e185e1550ecfaf4 /generic
parent110cfc4cd2fbba3b055733797062369c446da833 (diff)
downloadtk-7e3535dff93c2665d3f6f513bb5e68c5125aa717.zip
tk-7e3535dff93c2665d3f6f513bb5e68c5125aa717.tar.gz
tk-7e3535dff93c2665d3f6f513bb5e68c5125aa717.tar.bz2
* generic/tkTextDisp.c (CharUndisplayProc): fix textDisp.test crash.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkTextDisp.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 7e43bf1..4bfdd65 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextDisp.c,v 1.66 2007/09/20 22:59:40 dkf Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.67 2007/10/12 03:06:08 das Exp $
*/
#include "tkInt.h"
@@ -7515,32 +7515,34 @@ CharUndisplayProc(
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+ if (ciPtr) {
#if TK_LAYOUT_WITH_BASE_CHUNKS
- if (chunkPtr == ciPtr->baseChunkPtr) {
- /*
- * Basechunks are undisplayed first, when DLines are freed or
- * partially freed, so this makes sure we don't access their data any
- * more.
- */
+ if (chunkPtr == ciPtr->baseChunkPtr) {
+ /*
+ * Basechunks are undisplayed first, when DLines are freed or
+ * partially freed, so this makes sure we don't access their data
+ * any more.
+ */
- FreeBaseChunk(chunkPtr);
- } else if (ciPtr->baseChunkPtr != NULL) {
- /*
- * When other char chunks are undisplayed, drop their characters from
- * the base chunk. This usually happens, when they are last in a line
- * and need to be re-layed out.
- */
+ FreeBaseChunk(chunkPtr);
+ } else if (ciPtr->baseChunkPtr != NULL) {
+ /*
+ * When other char chunks are undisplayed, drop their characters
+ * from the base chunk. This usually happens, when they are last
+ * in a line and need to be re-layed out.
+ */
- RemoveFromBaseChunk(chunkPtr);
- }
+ RemoveFromBaseChunk(chunkPtr);
+ }
- ciPtr->baseChunkPtr = NULL;
- ciPtr->chars = NULL;
- ciPtr->numBytes = 0;
+ ciPtr->baseChunkPtr = NULL;
+ ciPtr->chars = NULL;
+ ciPtr->numBytes = 0;
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
- ckfree((char *) ciPtr);
- chunkPtr->clientData = NULL;
+ ckfree((char *) ciPtr);
+ chunkPtr->clientData = NULL;
+ }
}
/*