Kirix Support Forums

[PATCH PROVIDED]Crash when closing/reopening panes

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

[PATCH PROVIDED]Crash when closing/reopening panes

Postby gnschmidt on Wed Oct 04, 2006 6:40 am

This crash is somewhat erratic, but it always strikes after a few hide/show steps.

Here's an excerpt from the gdb output:

Code: Select all
Program received signal
signal-name
SIGSEGV
Segmentation fault
frame-function-name
wxFrameManager::UpdateButtonOnScreen(wxDockUIPat*, wxMouseEvent const&)
frame-args{
arg-begin
this
arg-name-end
=
arg-value *
0x1d10ea4
arg-end

frame-source-line
3639
frame-source-end

source C:/.../src/manager.cpp:3639:116567:beg0x514f58
frame-end
stopped

...

There is no member named SetDeviceOrigin.
Disabling display 1 to avoid infinite recursion.

The only way I can prevent this crash is by either commenting out the contents of UpdateButtonOnScreen or preventing it being called on rollover (i.e. it gets called at left button down/up, but not when the mouse hovers over the button).

I'm using 0.92 as published on this site. Should I be using the source from the wxW CVS?
Last edited by gnschmidt on Fri Oct 20, 2006 5:13 am, edited 1 time in total.
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby Ben on Thu Oct 05, 2006 7:00 am

Hello,

There has been a lot of work done on the wxWidgets CVS version of AUI since 0.9.2. We still desire to release a wxWidgets 2.6.3 backport of AUI, but haven't had the chance to do it just yet.

Would you try it using the cvs verison? I think that this bug, in particular, was fixed, if my memory serves me correctly.

Best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby gnschmidt on Thu Oct 19, 2006 9:49 am

I've upgraded to 2.7.1 and today's CVS version of aui, but the crash still happens. It usually takes less than five seconds to crash the program.

All I need to do is close all right-hand panes and bring them back quickly using a keyboard shortcut (in this example Ctrl+I reopens an Insert Child Node panel.)

As before, gdb traces the problem to UpdateButtonOnScreen, and it can be avoided if the two hover-related calls to UpdateButtonOnScreen (ll. 3828, 3832 in framemanager.cpp) are commented out.

In case I'm doing something terribly wrong in my source, this is the function used to bring back the panes:

Code: Select all
void MyFrame::OnInsertChild(wxCommandEvent& event)
{
  if (!insertChildPanel)
    return;

  wxPaneInfo info = manager.GetPane(insertChildPanel);
  if (!info.IsOk())
  {
    return;
  }
  if (!info.IsShown())
  {
    manager.GetPane(insertChildPanel).Show(true);
    manager.Update();
  }
  insertChildPanel->setEditFocus();
}
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby gnschmidt on Fri Oct 20, 2006 5:09 am

I think I've fixed this now.

I narrowed the problem down to the close-on-click behaviour. The error occurs only when the mouse moves while the close pane is pressed and the left button is released on another pane (or worse in between, in which case a raw NULL pointer is dereferenced in UpdateButtonOnScreen).

Not all occurrences are down to NULL pointers, though: at times moving to another pane managed by wxFrameManager is enough to crash the application.

My solution is to add the following lines near the top of UpdateButtonOnScreen at framemanager.cpp l. 3345 (immediately after wxDocUIPart *hit_test = HitTest(event.GetX(), event.GetY());).


Code: Select all
    if (
      !button_ui_part ||
      !hit_test ||
      (button_ui_part->pane != hit_test->pane))
    {
      return;
    }


So far I have not been able to crash the function with this patch in place. Would you like me to post this separately under Patches, or can you think of a more elegant way of preventing these crashes?
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby Ben on Sat Oct 21, 2006 3:15 am

Hello,

Thanks for this information and the code posted. I'll try to get this integrated as soon as possible.

Best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby gnschmidt on Wed Nov 08, 2006 4:56 am

Just a quick note to say that I recently took the CVS version and this crash persists. I know the proposed patch affects the symptom rather than the cause, but it's a little worrying that anyone can crash wxAUI apps by clicking on a close button and releasing the mouse button between panes or (sometimes) just on another pane.
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby Ben on Wed Nov 08, 2006 8:07 am

Hi,

Hmm, I thought I had this one fixed (as of yesterday). When did you try out the cvs? I want to get this one solved before 2.8.0

Thanks,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby gnschmidt on Wed Nov 08, 2006 9:41 am

Ben, thanks for the swift reply! I tried it a few days ago, so I will fetch a fresh copy of the files from CVS.
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby gnschmidt on Mon Nov 13, 2006 10:55 am

I can confirm that this is now fixed in CVS (tested using last night's snapshot). Great work!
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Return to wxAUI Questions, Thoughts & Feedback