git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39983
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
if (event.button == wxPaneInfo::buttonClose)
{
- pane.Hide();
- Update();
+ if (pane.IsOk())
+ {
+ wxWindow * pane_window = pane.window;
+ wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+ cancelEvent.SetEventObject( pane_window );
+ pane_window->GetEventHandler()->ProcessEvent(cancelEvent);
+
+ // The problem here is that the above can cause the window itself to be destroyed
+ if (!pane_window->IsBeingDeleted() && pane.IsOk())
+ {
+ pane.Hide();
+ Update();
+ }
+ }
}
else if (event.button == wxPaneInfo::buttonPin)
{