summaryrefslogtreecommitdiffstats
path: root/generic/tkTextWind.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-01-31 20:44:12 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-01-31 20:44:12 (GMT)
commitad747d4f1eeb6b1bc5029c319b13a1c1c61a9df4 (patch)
treeebe9ca0295b16b7da811ce0727803695a3ade5ab /generic/tkTextWind.c
parenta5cb5cdaf088782fcccf2534e950c39a12c16f02 (diff)
parentfaf7267ef33d043ebe467ad0b6aede6c4b784e99 (diff)
downloadtk-ad747d4f1eeb6b1bc5029c319b13a1c1c61a9df4.zip
tk-ad747d4f1eeb6b1bc5029c319b13a1c1c61a9df4.tar.gz
tk-ad747d4f1eeb6b1bc5029c319b13a1c1c61a9df4.tar.bz2
Fix [1501749fff] - Crash on embedded window deletion bound to <Map> events.
Diffstat (limited to 'generic/tkTextWind.c')
-rw-r--r--generic/tkTextWind.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 7d56084..d63ad32 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1129,6 +1129,16 @@ TkTextEmbWinDisplayProc(
&lineX, &windowY, &width, &height);
windowX = lineX - chunkPtr->x + x;
+ /*
+ * Mark the window as displayed so that it won't get unmapped.
+ * This needs to be done before the next instruction block because
+ * Tk_MaintainGeometry/Tk_MapWindow will run event handlers, in
+ * particular for the <Map> event, and if the bound script deletes
+ * the embedded window its clients will get freed.
+ */
+
+ client->displayed = 1;
+
if (textPtr->tkwin == Tk_Parent(tkwin)) {
if ((windowX != Tk_X(tkwin)) || (windowY != Tk_Y(tkwin))
|| (Tk_ReqWidth(tkwin) != Tk_Width(tkwin))
@@ -1140,16 +1150,6 @@ TkTextEmbWinDisplayProc(
Tk_MaintainGeometry(tkwin, textPtr->tkwin, windowX, windowY,
width, height);
}
-
- /*
- * Mark the window as displayed so that it won't get unmapped.
- * <TODO>: Tk_MaintainGeometry/Tk_MapWindow may run event handlers,
- * in particular for the <Map> event. If the bound script
- * deletes the embedded window or the text widget we will
- * soon crash.
- */
-
- client->displayed = 1;
}
/*