summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2012-11-07 14:22:06 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2012-11-07 14:22:06 (GMT)
commit1575d70202dda13e527b5fc091fc22cc2e67e9f4 (patch)
tree3a2bac232ac08eadf285f6ea9e5ecfb6225840d9
parentfde350fbd3e158126d44ad2b4a7f338e44619304 (diff)
downloadtk-1575d70202dda13e527b5fc091fc22cc2e67e9f4.zip
tk-1575d70202dda13e527b5fc091fc22cc2e67e9f4.tar.gz
tk-1575d70202dda13e527b5fc091fc22cc2e67e9f4.tar.bz2
[Bug 3574708]: Move window liveness checks to better location.
-rw-r--r--ChangeLog7
-rw-r--r--generic/tkFocus.c12
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 68dd29a..e39ebd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-11-07 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFocus.c (TkSetFocusWin): [Bug 3574708]: Move window
+ liveness into this function from caller sites to ensure that there are
+ no paths where things can trip up on setting the focus to a partially
+ dead window.
+
2012-10-24 Don Porter <dgp@users.sourceforge.net>
* macosx/tkMacOSXWm.c: [Bug 3574893] Add overlooked toplevel ref
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 4814c17..85093ee 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -160,9 +160,7 @@ Tk_FocusObjCmd(
if (newPtr == NULL) {
return TCL_ERROR;
}
- if (!(newPtr->flags & TK_ALREADY_DEAD)) {
- TkSetFocusWin(newPtr, 0);
- }
+ TkSetFocusWin(newPtr, 0);
return TCL_OK;
}
}
@@ -552,6 +550,14 @@ TkSetFocusWin(
TkWindow *topLevelPtr;
int allMapped, serial;
+ /*
+ * Don't set focus if window is already dead. [Bug 3574708]
+ */
+
+ if (winPtr->flags & TK_ALREADY_DEAD) {
+ return;
+ }
+
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
/*