summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--tests/wm.test29
-rw-r--r--win/tkWinWm.c6
3 files changed, 35 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 20e58f9..7e37b51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2008-07-26 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * win/tkWinWm.c: Check that the parent has been mapped before
+ * tests/wm.test: calling RemapWindows. [Bug 2009788]
+
* win/tkWinWindow.c: Check for 0x prefix in sprintf %p. Bug [2026405]
2007-02-24 Jan Nijtmans <nijtmans@users.sf.net>
diff --git a/tests/wm.test b/tests/wm.test
index f797a43..dd115b8 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: wm.test,v 1.40 2008/07/23 23:24:25 nijtmans Exp $
+# RCS: @(#) $Id: wm.test,v 1.41 2008/07/26 13:03:06 patthoyts Exp $
# This file tests window manager interactions that work across platforms.
# Window manager tests that only work on a specific platform should be placed
@@ -2138,6 +2138,33 @@ test wm-manage-1.2 {unmanaging a toplevel} -setup {
deleteWindows
} -result {wm .t.t pack .t wm .t.t}
+test wm-forget-1.1 "bug #2009788: forget toplevel can cause crash" -body {
+ toplevel .parent
+ toplevel .parent.child
+ wm forget .parent.child
+ winfo exists .parent.child
+} -cleanup {
+ deleteWindows
+} -result {1}
+test wm-forget-1.2 "bug #2009788: forget toplevel can cause crash" -body {
+ toplevel .parent
+ update
+ toplevel .parent.child
+ wm forget .parent.child
+ winfo exists .parent.child
+} -cleanup {
+ deleteWindows
+} -result {1}
+test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
+ toplevel .parent
+ toplevel .parent.child
+ wm forget .parent.child
+ wm manage .parent.child
+ winfo exists .parent.child
+} -cleanup {
+ deleteWindows
+} -result {1}
+
# FIXME:
# Test delivery of virtual events to the WM. We could check to see if the
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index e2cda93..070bb3f 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinWm.c,v 1.126 2008/05/02 10:28:18 dkf Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.127 2008/07/26 13:03:07 patthoyts Exp $
*/
#include "tkWinInt.h"
@@ -3705,7 +3705,9 @@ WmForgetCmd(
if (Tk_IsTopLevel(frameWin)) {
Tk_UnmapWindow(frameWin);
winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
- RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window));
+ if (Tk_IsMapped(Tk_Parent(frameWin))) {
+ RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window));
+ }
TkWmDeadWindow(winPtr);
/* flags (above) must be cleared before calling */
/* TkMapTopFrame (below) */