summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-01 22:07:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-01 22:07:13 (GMT)
commit1982854fca362c591e818f5aac91386ab3d2567e (patch)
treeddc49542ea318e9e9ad896d2dc152cfb70ef865f /generic/tkTextDisp.c
parent1ebb0c9d23b20f48bb8d5cc30f30532c99823731 (diff)
parentf4d17d021d7c47a9b6306a641a358da4b9cabd00 (diff)
downloadtk-1982854fca362c591e818f5aac91386ab3d2567e.zip
tk-1982854fca362c591e818f5aac91386ab3d2567e.tar.gz
tk-1982854fca362c591e818f5aac91386ab3d2567e.tar.bz2
Merge 8.7
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r--generic/tkTextDisp.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index dd70e57..adebd78 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -2567,6 +2567,13 @@ DisplayDLine(
display, pixmap, dlPtr->y + dlPtr->spaceAbove);
}
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
+ /*
+ * A displayProc called in the loop above invoked a binding
+ * that caused the widget to be deleted. Don't do anything.
+ */
+ return;
+ }
if (dInfoPtr->dLinesInvalidated) {
return;
}
@@ -4223,7 +4230,7 @@ DisplayText(
/*
* Choose a new current item if that is needed (this could cause event
- * handlers to be invoked, hence the preserve/release calls and the loop,
+ * handlers to be invoked, hence the refcount management and the loop,
* since the handlers could conceivably necessitate yet another current
* item calculation). The tkwin check is because the whole window could go
* away in the Tcl_Release call.
@@ -4502,11 +4509,18 @@ DisplayText(
LOG("tk_textRedraw", string);
}
DisplayDLine(textPtr, dlPtr, prevPtr, pixmap);
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
+ /*
+ * DisplayDLine called a displayProc which invoked a binding
+ * that caused the widget to be deleted. Don't do anything.
+ */
+ goto end;
+ }
if (dInfoPtr->dLinesInvalidated) {
#ifndef TK_NO_DOUBLE_BUFFERING
Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
- return;
+ goto end;
}
dlPtr->oldY = dlPtr->y;
dlPtr->flags &= ~(NEW_LAYOUT | OLD_Y_INVALID);