Using wxSmith to create a dialog and its code.
I have a problem with a dialog-based application crashing with a segmentation fault in wxWindowBase::InformFirstDirection(...) because when it calls GetSizer() to use as a pointer, that function is returning zero. This is line 871 in wincmn.cpp.
I have cut it down to the very minimum of wxDialog containing wxBoxSizer (horizontal) which contains a wxPanel containing a second wxBoxSizer (vertical).
Running without debug gives SIGSEGV with a termination code of -1073740771 in the call to wxSizer::Fit(...).
This is the code in the dialog constructor (generated by wxSmith):
Code: Select all
{
wxBoxSizer* BoxSizer2;
wxBoxSizer* BoxSizer1;
Create(parent, wxID_ANY, _("Spine"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(137,566), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
BoxSizer2 = new wxBoxSizer(wxVERTICAL);
Panel1->SetSizer(BoxSizer2);
SetSizer(BoxSizer2);
Layout();
BoxSizer1->Add(Panel1, 1, wxALL, 5);
SetSizer(BoxSizer1);
BoxSizer1->Fit(this); //<--- SEG FAULT IN THIS CALL
BoxSizer1->SetSizeHints(this);
}
(This is my first post - I hope I have supplied enough information.)