diff options
author | patthoyts@users.sourceforge.net <patthoyts> | 2008-08-01 19:38:58 (GMT) |
---|---|---|
committer | patthoyts@users.sourceforge.net <patthoyts> | 2008-08-01 19:38:58 (GMT) |
commit | 7bf7fc934e49b4b68a23a120ce3ce9a99619e75a (patch) | |
tree | fe2825b400bfb502c075f42539458f482ff41849 | |
parent | 5f89c906f42f2f40191cbd8f315316221b8f4ed4 (diff) | |
download | tk-7bf7fc934e49b4b68a23a120ce3ce9a99619e75a.zip tk-7bf7fc934e49b4b68a23a120ce3ce9a99619e75a.tar.gz tk-7bf7fc934e49b4b68a23a120ce3ce9a99619e75a.tar.bz2 |
Check wmPtr is valid in TopLevelReqProc to fix [Bug 2028703]
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | tests/wm.test | 12 | ||||
-rw-r--r-- | win/tkWinWm.c | 16 |
3 files changed, 25 insertions, 8 deletions
@@ -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; + } } } |