Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed XmuClientWindow, was killing Perl with BadWindow #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mcast
Copy link
Contributor

@mcast mcast commented Oct 16, 2014

I finally tracked down the cause of a BadWindow that was unceremoniously killing our application.

I still don't know what is sending the ClientMessage(WM_PROTOCOL) to us or how to provoke that,
but it gives a windowid=0x1 and the would crash the app until d2446dd.

I haven't attempted to test that XmuClientWindow still works, but I have seen ClientMessages go past
which would otherwise have crashed.

to fix a rare but persistent BadWindow crash
seen on (Lenny, Lucid) Gnome desktop
often after closing another application


event sequence:
 ClientMessage: serial=42280 send_event=1 win=0x1 mtype=atom#275 fmt=32 data=0x120 0x2d044 0x1 0x0 0x0
 XmuClientWindow(win 0x1)
 ClientWin.c:65: XGetWindowProperty for atom#311 'WM_STATE' of 0x1 on :0.0 [Last=42282, next=42283]

atom#275 is WM_PROTOCOLS
without the patch, ClientWin.c:65 will provoke an error e.g.

  X Error of failed request:  BadWindow (invalid Window parameter)
     Major opcode of failed request:  20 (X_GetProperty)
     Resource id in failed request:  0x1
     Serial number of failed request:  1586296
     Current serial number in output stream:  1586296
…ndow-BadWindow

* fix/XmuClientWindow-BadWindow.old:
  wrap XmuClientWindow's XGetWindowProperty in Tk_CreateErrorHandler
@mcast
Copy link
Contributor Author

mcast commented Oct 21, 2014

In internal discussion, the question arose "from where is this called?". tkEvent.c

@mcast
Copy link
Contributor Author

mcast commented Oct 21, 2014

I noticed some evidence (shaky, due to insufficient logging of atom numbers) that the message causing this is a _NET_WM_PING; and that our ignoring this by trapping the BadWindow is then causing the tk app to be effectively "xkill"ed.

Why would our tk windows get _NET_WM_PING (on Ubuntu Lucid Gnome desktops) when we have only
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW
or on the MainWindow,
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_SAVE_YOURSELF

Therefore, the fix may not be as simple as just masking the error with a handler..?

@mcast
Copy link
Contributor Author

mcast commented Dec 4, 2014

We would like to get this merged so we can deploy a release version which doesn't crash this way.
Do I need to make any changes?

@mcast
Copy link
Contributor Author

mcast commented Dec 4, 2014

Ed (a co-worker) brought up the suspicious

pTk/mTk/xlib/X11/X.h:#define InputFocus 1L /* destination window in SendEvent */

after reading Xlib Reference Manual (vol 2). The circumstances of crashes do suggest an input focus change caused by one application closing and some Tk widget regaining focus.

We don't understand why the event with Window 0x1 was passed to Tk without translation to the actual windowid. Surely X should do that? But maybe not.

mcast added a commit to mcast/perl-tk that referenced this pull request Dec 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant