summaryrefslogtreecommitdiffstats
path: root/win/tkWinWm.c
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-06-02 09:26:57 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-06-02 09:26:57 (GMT)
commit5098f86b8c628ee641dfd130ec9f516d91805eff (patch)
treebc1b4e39a7f4d9c50c7e9fa7d09c7cda6e968889 /win/tkWinWm.c
parent90c1a43eb7a8a363aef33e43ff390646b70aff1f (diff)
downloadtk-5098f86b8c628ee641dfd130ec9f516d91805eff.zip
tk-5098f86b8c628ee641dfd130ec9f516d91805eff.tar.gz
tk-5098f86b8c628ee641dfd130ec9f516d91805eff.tar.bz2
[Bug 2799589] Avoid setting the focus on a deleted window during delayed activation.
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r--win/tkWinWm.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index c038194..c272e65 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.138 2009/05/03 06:46:13 dkf Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.139 2009/06/02 09:26:57 patthoyts Exp $
*/
#include "tkWinInt.h"
@@ -8259,10 +8259,20 @@ ActivateWindow(
*/
if (winPtr) {
+ Window window;
if (TkGrabState(winPtr) != TK_GRAB_EXCLUDED) {
- SetFocus(Tk_GetHWND(winPtr->window));
+ window = winPtr->window;
} else {
- SetFocus(Tk_GetHWND(winPtr->dispPtr->grabWinPtr->window));
+ window = winPtr->dispPtr->grabWinPtr->window;
+ }
+
+ /*
+ * Ensure the window was not destroyed while we were postponing
+ * the activation [Bug 2799589]
+ */
+
+ if (window) {
+ SetFocus(Tk_GetHWND(window));
}
}