summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkTextDisp.c7
-rw-r--r--tests/textWind.test2
2 files changed, 8 insertions, 1 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 434bd83..465e453 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -4500,6 +4500,13 @@ 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);
diff --git a/tests/textWind.test b/tests/textWind.test
index 76cf6f9..297ec50 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -1619,7 +1619,7 @@ test textWind-18.1 {embedded window deletion triggered by a script bound to <Map
destroy .t .f .f2
} -result {}
-test textWind-18.2 {text widget deletion triggered by a script bound to embedded window mapping} -constraints knownBug -setup {
+test textWind-18.2 {text widget deletion triggered by a script bound to embedded window mapping} -setup {
catch {destroy .t .f}
} -body {
pack [text .t]