Skip to content

Setting a AUI pane to be non-resizable sometimes causes a crash #135

Description

@halfer

I'm preparing an extension to the AUI demo [edit: now in master] that allows pane options to be turned on and off for each pane. It's mostly working but there's a few wrinkles to fix before submitting a PR.

There are two items that sometimes causes a crash: they are attempting to resize where the draggable border touches a non-resizable pane, or on rare occasions, toggling the resize status of a pane. The error on the console looks like this:

*** Caught unhandled unknown exception; terminating
Segmentation fault (core dumped)

I'm struggling to determine an exact set of reproduce instructions - presently I am toggling the resize property on a number of panes until it crashes! It's worth noting that when a property (such as resizability) changes, I am detaching the pane and re-adding it - this feels like a bit of hack but is the only way it seems to redraw correctly at present. It is possible that by doing that in a more elegant fashion, this issue might resolve itself too.

It occurs to me also that perhaps giving a pane an explicit size prior to removing resizability might help?

It may help for me to produce a simplified example to narrow down the cause, but perhaps someone can suggest things to make the code more stable in the meantime?

The rough-and-ready code to re-attach panes to redraw them is thus:

protected function onPaneTickBoxChange(wxEvent $event)
{
    // Get the currently selected pane
    $paneIndex = $this->getSelectedPaneIndex();
    /* @var $paneInfo wxAuiPaneInfo */
    $paneInfo = $this->getPaneInfoByIndex($paneIndex);

    // Set new flag true/false on paneinfo, using setter methods
    /* @var $ctrl wxCheckBox */
    $ctrl = wxDynamicCast($event->GetEventObject(), "wxCheckBox");
    $methods = $this->getPaneSetterMethods();
    $method = $methods[$ctrl->GetName()];
    $paneInfo->$method($ctrl->GetValue());

    /* @var $window \wxTextCtrl */
    /* @var $manager \wxAuiManager */
    $window = $this->getManagedWindow()->getWindowByIndex($paneIndex);
    $manager = $this->getManagedWindow()->getAuiManager();

    // This sort of works, but the pane sometimes ends up being moved
    $manager->DetachPane($window);
    $manager->AddPane($window, $paneInfo);

    // Now redraw the panes
    $this->getManagedWindow()->getAuiManager()->Update();
}

Activity

  1. jgmdev commented on Jan 25, 2016

    @jgmdev
    Member

    This is incomprehensible, I just ran the demo and it crashed on some panes, then I ran it with valgrind to debug it, but it didn't crashed :S, maybe some kind of race condition not triggered when running with valgrind...

  2. halfer commented on Jan 26, 2016

    @halfer
    ContributorAuthor

    Confusing! Thanks for looking into it, perhaps we can get more eyes on the C code to see what might be up.

    Incidentally, re this:

    It's worth noting that when a property (such as resizability) changes, I am detaching the pane and re-adding it - this feels like a bit of hack but is the only way it seems to redraw correctly at present. It is possible that by doing that in a more elegant fashion, this issue might resolve itself too.

    I have a fix for this, though it would of course be nice to address the stability issue. I'll send a PR for the improved way to refresh panes in due course.

  3. halfer commented on Jan 31, 2016

    @halfer
    ContributorAuthor

    Regarding the PR I mentioned above to redraw panes in an elegant manner, that didn't work in this case. It works when re-opening a closed pane (PR #142) but not when changing close/maximise/pin features. I'll raise a separate issue for that when time allows - I think there's some changes on the C side required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions