Rodney Stevens wrote:
To answer your questions
The application has 2 major windows one of which has tabs to 6 panes with a
lot of widgets, the other 4 windows/dialogs are basic.
Since we’re talking about a window manager problem, it doesn’t matter
what kind of widgets you have in the windows. As far as pwm is
concerned, a window is atomic, and the widgets in your window are just
some private data structures that your application uses to keep track of
what to draw in the window and how to react to clicks at different
positions in the window. And, of course, pwm doesn’t care what you draw
or how you react to clicks, unless the reaction involves opening,
closing, or changing the state of windows.
“Closing windows” Yes I have had it do this, so I reconfigured the program
so that the main window never closes. Now I only seem to get it when someone
clicks a button. Opening and closing sub windows does not seem to pose the
The reason I asked about opening and closing windows is because there’s
a known bug in pwm that can sometimes cause a crash after you close a
parent window that has a child window, but only if one of them has the
Ph_WM_FOCUS flag unset (I don’t remember which one). If your crash
happens when no windows are being closed, or when all windows have the
Ph_WM_FOCUS flag set, then it seems that you have discovered a different
Clicking a button has code in the callback to change the image attached to
that button as well as doing the callback task There is also an image
asingned to the button to indicate that it has been pressed. I don’t know
whether this may have anything to do with the instability.
No, pwm has no way to know anything about your buttons or their images.
This fault only shows up randomly and is not reproduceable by doing the same
sequence of button presses.
That part is consistent with the known bug: since it involves accessing
memory after it’s been freed, the crash depends on subtle details of
what your heap happens to look like, which is affected by such things as
the speed of your mouse when it touched a window frame, which parts of
the frame it touched, and so on.
The buttons are on the window that has focus. One brings up a new window the
other just changes the button image as explained above.
Does the crash actually happen when a new window is being opened?
Does it depend on whether the window you click on has the focus already
or it’s the click that gives it focus?
I will have to check the Ph_WM_FOCUS flags.
Could data/array pointer errors corrupt something that could cause the pmw
to crash or is it memory protected from my application (I thought it would
The memory is protected, but theoretically, a corruption could cause you
to send a bad message that pwm doesn’t know how to handle. Of course,
there’s code in pwm that checks the sanity of incoming messages and
tries to reject the obviously silly ones, but since that code is not
something that gets a high priority in our testing, there’s a chance
that it’s not completely bullet-proof.
But if it was your application corrupting its memory, I’d expect it to
crash more often than cause pwm to crash – have you seen your
application crash, too?
Thanks for these thoughts.