The [focus] command will dump core if the target window
is a widget
with certain unusual characteristics. If the target
window is the top
of a window hierarchy but is NOT a toplevel with a
wrapper window,
it will core dump. To demonstrate the problem, get the
"rootwin"
widget extension (which makes the X display's root
window into
a Tk widget):
http://www.eecs.umich.edu/~mckay/computer/rootwin0.4.tar.gz
Then do the following:
load /path/to/libRootwin0.4.so
rootwin .r
focus -force .r
The problem is in tkFocus.c; I fixed it, and the diff
looks like:
diff tkFocus.c.orig tkFocus.c
565c565
< TkWindow *topLevelPtr;
---
> TkWindow *topLevelPtr, *focusToplevelPtr;
667c667,671
< serial =
TkpChangeFocus(TkpGetWrapperWindow(topLevelPtr), force);
---
> focusToplevelPtr =
TkpGetWrapperWindow(topLevelPtr);
> if (focusToplevelPtr == NULL) {
> focusToplevelPtr = topLevelPtr;
> }
> serial = TkpChangeFocus(focusToplevelPtr, force);
NOTE: there's a bad line break in the diff, but you can
see that
the fix is simple. Address questions to:
mckay at eecs dot umich dot edu
Logged In: YES
user_id=72656
attached is a clean patch against the HEAD, but I have focus
issues when running the tests on linux that I would like to
understand better first.
Logged In: YES
user_id=79902
Is this still relevant post TIP#153?
Logged In: YES
user_id=131705
Yes, I believe this bug is still relevant post TIP#153. In
fact this bug has to be fixed in order for TIP#153 to be
useful. This is a place where the Tk code assumes that the
top-level window in a hierarchy is an actual [toplevel]
widget (or, more correctly, it assumes that the
top-of-hierarchy widget has a wrapper window). If it is not
a toplevel, the code dereferences a NULL pointer.