summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-09-30 14:46:48 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-09-30 14:46:48 (GMT)
commit009394840a93391fb574b4cbc7a9eb114ee3da7b (patch)
treee54a25a1760e53ba8d6d8b8049addba8621c8b41
parentee2ce93b2a9f94bf0fb220792ca75b6bdce7478c (diff)
parenta7bd1b8b54051af0e4a59ca36d6fa8cbbd221487 (diff)
downloadtk-009394840a93391fb574b4cbc7a9eb114ee3da7b.zip
tk-009394840a93391fb574b4cbc7a9eb114ee3da7b.tar.gz
tk-009394840a93391fb574b4cbc7a9eb114ee3da7b.tar.bz2
merge core-8-5-branch. tip_437
This is the TIP #437 implementation being voted on.
-rw-r--r--generic/tkTextWind.c16
-rw-r--r--tests/textWind.test14
-rwxr-xr-xwin/configure4
-rw-r--r--win/tcl.m44
4 files changed, 28 insertions, 10 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 8d1f850..5b511d2 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1123,6 +1123,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))
@@ -1134,12 +1144,6 @@ TkTextEmbWinDisplayProc(
Tk_MaintainGeometry(tkwin, textPtr->tkwin, windowX, windowY,
width, height);
}
-
- /*
- * Mark the window as displayed so that it won't get unmapped.
- */
-
- client->displayed = 1;
}
/*
diff --git a/tests/textWind.test b/tests/textWind.test
index 79dca50..2e16f7b 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -1023,6 +1023,20 @@ test textWind-17.9 {peer widget window configuration} {
set res
} {{-window {} {} {} {}} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
+test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} {
+ catch {destroy .t .f}
+ pack [text .t]
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
+ .t window create end -window [frame .f -background red -width 80 -height 80]
+ .t window create end -window [frame .f2 -background blue -width 80 -height 80]
+ bind .f <Map> {.t delete .f}
+ update
+ # this shall not crash (bug 1501749)
+ after 100 {.t yview end}
+ tkwait visibility .f2
+ update
+} {}
+
catch {destroy .t}
option clear
diff --git a/win/configure b/win/configure
index 57e0453..c493d8b 100755
--- a/win/configure
+++ b/win/configure
@@ -3828,7 +3828,7 @@ echo "${ECHO_T}using shared flags" >&6
LIBRARIES="\${SHARED_LIBRARIES}"
SHLIB_LD_LIBS='${LIBS}'
case "x`echo \${VisualStudioVersion}`" in
- x14*)
+ x1[4-9]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
;;
*)
@@ -3873,7 +3873,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
LIBS="user32.lib advapi32.lib ws2_32.lib"
case "x`echo \${VisualStudioVersion}`" in
- x14*)
+ x1[4-9]*)
LIBS="$LIBS ucrt.lib"
;;
*)
diff --git a/win/tcl.m4 b/win/tcl.m4
index 6f10a96..aa3c4b3 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -784,7 +784,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LIBRARIES="\${SHARED_LIBRARIES}"
SHLIB_LD_LIBS='${LIBS}'
case "x`echo \${VisualStudioVersion}`" in
- x14*)
+ x1[4-9]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
;;
*)
@@ -826,7 +826,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LIBS="user32.lib advapi32.lib ws2_32.lib"
case "x`echo \${VisualStudioVersion}`" in
- x14*)
+ x1[4-9]*)
LIBS="$LIBS ucrt.lib"
;;
*)