summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-11-22 23:49:26 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-11-22 23:49:26 (GMT)
commitb324030ef3e727628dff5e52fd769267a3eae6dd (patch)
treedeb2392397b971085b6ff3050dd35e5b766099fa
parent64111bfca435c01cabf3714b084885957f1cb247 (diff)
downloadtk-b324030ef3e727628dff5e52fd769267a3eae6dd.zip
tk-b324030ef3e727628dff5e52fd769267a3eae6dd.tar.gz
tk-b324030ef3e727628dff5e52fd769267a3eae6dd.tar.bz2
Make sure the window is still present when handling delayed activation [Bug 2899949]
-rw-r--r--ChangeLog3
-rw-r--r--win/tkWinWm.c19
2 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 76e8e01..aaae10c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2009-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * tests/winWm.test: Make sure the window is still present
+ * win/tkWinWm.c: when handling delayed activation [Bug 2899949]
+
* win/Makefile.vc: Include tk stubs in the tktest link
2009-11-21 Donal K. Fellows <dkf@users.sf.net>
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 9e969c7..26d9d55 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.141 2009/08/10 23:16:28 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.142 2009/11/22 23:49:26 patthoyts Exp $
*/
#include "tkWinInt.h"
@@ -43,7 +43,8 @@
typedef struct ActivateEvent {
Tcl_Event ev;
TkWindow *winPtr;
- int *flagPtr;
+ const int *flagPtr;
+ HWND hwnd;
} ActivateEvent;
/*
@@ -422,7 +423,7 @@ TCL_DECLARE_MUTEX(winWmMutex)
static int ActivateWindow(Tcl_Event *evPtr, int flags);
static void ConfigureTopLevel(WINDOWPOS *pos);
static void GenerateConfigureNotify(TkWindow *winPtr);
-static void GenerateActivateEvent(TkWindow *winPtr, int *flagPtr);
+static void GenerateActivateEvent(TkWindow *winPtr, const int *flagPtr);
static void GetMaxSize(WmInfo *wmPtr,
int *maxWidthPtr, int *maxHeightPtr);
static void GetMinSize(WmInfo *wmPtr,
@@ -8206,13 +8207,14 @@ TkpGetWrapperWindow(
*/
static void
-GenerateActivateEvent(TkWindow * winPtr, int *flagPtr)
+GenerateActivateEvent(TkWindow * winPtr, const int *flagPtr)
{
ActivateEvent *eventPtr;
eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent));
eventPtr->ev.proc = ActivateWindow;
eventPtr->winPtr = winPtr;
eventPtr->flagPtr = flagPtr;
+ eventPtr->hwnd = Tk_GetHWND(winPtr->window);
Tcl_QueueEvent((Tcl_Event *)eventPtr, TCL_QUEUE_TAIL);
}
@@ -8245,6 +8247,15 @@ ActivateWindow(
}
/*
+ * Ensure the window has not been destroyed while we delayed
+ * processing the WM_ACTIVATE message [Bug 2899949].
+ */
+
+ if (!IsWindow(eventPtr->hwnd)) {
+ return 1;
+ }
+
+ /*
* If the toplevel is in the middle of a move or size operation then
* we must delay handling of this event to avoid stealing the focus
* while the window manage is in control.