summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2012-11-07 14:23:34 (GMT)
committerdkf <dkf@noemail.net>2012-11-07 14:23:34 (GMT)
commit9e63ff95798ec7ff7f442602a8fcfe5393c6f573 (patch)
tree99a0c54004df193333f869b78f209f6f138fad17
parentc44a566acf9f950857bbb8a5ab8764cd839fdb06 (diff)
parent1b54341752a8686e36fab741969c78287f696b9d (diff)
downloadtk-9e63ff95798ec7ff7f442602a8fcfe5393c6f573.zip
tk-9e63ff95798ec7ff7f442602a8fcfe5393c6f573.tar.gz
tk-9e63ff95798ec7ff7f442602a8fcfe5393c6f573.tar.bz2
[Bug 3574708]: Move window liveness checks to better location.
FossilOrigin-Name: 2ccde2327e183fa1c541a7c05b4e7dc1dca85f7f
-rw-r--r--ChangeLog7
-rw-r--r--generic/tkFocus.c12
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b3337ea..dcaa26a 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 b5e2edf..cfd2216 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -153,9 +153,7 @@ Tk_FocusObjCmd(
if (newPtr == NULL) {
return TCL_ERROR;
}
- if (!(newPtr->flags & TK_ALREADY_DEAD)) {
- TkSetFocusWin(newPtr, 0);
- }
+ TkSetFocusWin(newPtr, 0);
return TCL_OK;
}
}
@@ -545,6 +543,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);
/*