summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2008-08-01 19:38:58 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2008-08-01 19:38:58 (GMT)
commit638e7df06d0096e3efb86c4410205fe56e10358d (patch)
treefe2825b400bfb502c075f42539458f482ff41849
parent62713768eda1dfeb194cbef982b9bbea710cd64d (diff)
downloadtk-638e7df06d0096e3efb86c4410205fe56e10358d.zip
tk-638e7df06d0096e3efb86c4410205fe56e10358d.tar.gz
tk-638e7df06d0096e3efb86c4410205fe56e10358d.tar.bz2
Check wmPtr is valid in TopLevelReqProc to fix [Bug 2028703]
-rw-r--r--ChangeLog5
-rw-r--r--tests/wm.test12
-rw-r--r--win/tkWinWm.c16
3 files changed, 25 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 18b0d3e..29b4d7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinWm.c: Check wmPtr is valid in TopLevelReqProc
+ * test/wm.test: to fix [Bug 2028703]
+
2008-07-31 Don Porter <dgp@users.sourceforge.net>
* generic/tk.h: Added missing EXTERN for the Tcl_PkgInitStubsCheck
diff --git a/tests/wm.test b/tests/wm.test
index dd115b8..725317d 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.41 2008/07/26 13:03:06 patthoyts Exp $
+# RCS: @(#) $Id: wm.test,v 1.42 2008/08/01 19:39:01 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
@@ -2164,6 +2164,16 @@ test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
} -cleanup {
deleteWindows
} -result {1}
+test wm-forget-1.4 "pack into unmapped toplevel causes crash" -body {
+ toplevel .parent
+ toplevel .parent.child
+ wm forget .parent.child
+ pack [button .parent.child.button -text Hello]
+ after 250 {destroy .parent}
+ tkwait window .parent
+} -cleanup {
+ deleteWindows
+} -result {}
# FIXME:
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 070bb3f..a82e9bb 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.127 2008/07/26 13:03:07 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.128 2008/08/01 19:39:04 patthoyts Exp $
*/
#include "tkWinInt.h"
@@ -5874,13 +5874,15 @@ TopLevelReqProc(
WmInfo *wmPtr;
wmPtr = winPtr->wmInfoPtr;
- if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) {
- SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
+ if (wmPtr) {
+ if ((winPtr->flags & TK_EMBEDDED) && (wmPtr->wrapper != NULL)) {
+ SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth(tkwin),
Tk_ReqHeight(tkwin));
- }
- if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
- wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
}
}