[Qt-interest] Problem: X Error: BadWindow (invalid Window parameter) 3 ...
Zeljko
zeljko at holobit.net
Tue Feb 3 17:11:41 CET 2009
Denis Dzyubenko wrote:
> One way to find out the source of the error might be to run your
> application with -sync command line option from inside with gdb and set
> a breakpoint inside the qt_x_errhandler function (it's inside
> src/gui/qapplication_x11.cpp) - so when the X error appears you'll be
> able to see the backtrace to find out which function caused an error and
> why.
Thanks for pointing me to the right direction. (it's not in src/gui but in
src/gui/kernel ;) )
I've investigated a little bit and seem that QApplication::widgetAt() (or
even topLevelAt() inside qapplication_x11.cpp) is problem (seem that it
stays in loop somehow). I'm calling it many times and when problem starts,
its always after call to QApplication::widgetAt().
Then I've inserted one-liner into qt_x_errhandler(), and after that (almost
2 days passed, I couldn't reproduce it anymore).
This does not need to be correct , I've put it here just to check if
anything changes .... but seem it is.
case BadWindow:
if (err->request_code == 2 /* X_ChangeWindowAttributes */
|| err->request_code == 38 /* X_QueryPointer */
/* Here is my code, it's possible that this shouldn't be
here..but hey..it works for me :) */
|| err->request_code == 40 /* X_TranslateCoords */) {
for (int i = 0; i < ScreenCount(dpy); ++i) {
if (err->resourceid == RootWindow(dpy, i)) {
// Perhaps we're running under SECURITY reduction? :/
return 0;
}
}
}
I've seen in docs that widgetAt() can be slow. So what to use instead of
widgetAt() to find out which window is under mouse cursor (if any) ?
What's the exact diff between widgetAt() and topLevelAt() ?
tnx.
zac.
More information about the Qt-interest-old
mailing list