summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-04-03 10:43:56 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-04-03 10:43:56 (GMT)
commitb1f5acd445e52aadf8ad909c78535aeaab0f60fe (patch)
tree02ff54d16a18a86049984d6ae5ed1f4c30c16725 /generic/tkTextDisp.c
parent4d7dd5c1d1a545bed4de7e4b6627e1302796b0f0 (diff)
parentfebcba8fc330403fb595f58acc3570f3d29fe1ed (diff)
downloadtk-b1f5acd445e52aadf8ad909c78535aeaab0f60fe.zip
tk-b1f5acd445e52aadf8ad909c78535aeaab0f60fe.tar.gz
tk-b1f5acd445e52aadf8ad909c78535aeaab0f60fe.tar.bz2
merge 8.6
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 6645912..cf1cb1b 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -2566,6 +2566,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;
}
@@ -4221,7 +4228,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.
@@ -4500,11 +4507,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);