I use wxFormBuilder to generate C++ code for many of my projects for MSW, but one thing has been bugging me for a long time.
This is what the tool generates for a simple button-on-a-form project:
Code: Select all
MyFrame2::MyFrame2( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
m_button2 = new wxButton( this, wxID_ANY, wxT("MyButton"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_button2, 0, wxALL, 5 );
this->SetSizer( bSizer3 );
this->Layout();
this->Centre( wxBOTH );
}
MyFrame2::~MyFrame2()
{
}
Does the memory ever gets freed and controls' destructors get called?
My working theory is that one of the frame parent's destructors destroys assigned via SetSizer sizer, which destroys every control added to it using Add.
Can anyone confirm that this is correct?