summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/winWm.test31
-rw-r--r--win/tkWinWm.c5
2 files changed, 33 insertions, 3 deletions
diff --git a/tests/winWm.test b/tests/winWm.test
index 7260a06..6b8fc81 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -533,6 +533,37 @@ test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win
}
destroy .tx .t .sd
} -result {ok}
+
+test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup {
+ destroy .t
+ toplevel .t
+ set winwm92 {}
+ frame .t.f -background blue -height 200 -width 200
+ frame .t.f.x -background red -height 100 -width 100
+} -body {
+ pack .t.f.x
+ pack .t.f
+ set aid [after 1000 {set ::winwm92 timeout}]
+ after 100 {
+ wm manage .t.f
+ wm iconify .t
+ after 100 {
+ wm forget .t.f
+ wm deiconify .t
+ after 100 {
+ pack .t.f
+ after 100 {set ::winwm92 [expr {[winfo rooty .t.f.x] == 0 ? "failed" : "ok"}]}
+ }
+ }
+ }
+ vwait ::winwm92
+ after cancel $aid
+ set winwm92
+} -cleanup {
+ destroy .t.f.x .t.f .t
+ unset -nocomplain winwm92 aid
+} -result ok
+
destroy .t
# cleanup
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 86f9dad..05073ac 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -3642,9 +3642,8 @@ WmForgetCmd(
if (Tk_IsTopLevel(frameWin)) {
Tk_UnmapWindow(frameWin);
winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
- if (Tk_IsMapped(Tk_Parent(frameWin))) {
- RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window));
- }
+ Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr);
+ RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window));
TkWmDeadWindow(winPtr);
/* flags (above) must be cleared before calling */
/* TkMapTopFrame (below) */