Add WXDestroyWithoutChildren() and use it from wxStaticBoxSizer

Factor out the code from wxStaticBoxSizer dtor into a wxStaticBox method
to improve encapsulation: the static box knows better than another class
how to detach its children from it before destroying it.

No real changes yet.
This commit is contained in:
Vadim Zeitlin
2017-12-19 21:47:01 +01:00
parent 87afebd6f2
commit aa47c15abd
3 changed files with 23 additions and 14 deletions

View File

@@ -2582,20 +2582,7 @@ wxStaticBoxSizer::~wxStaticBoxSizer()
// previous wxWidgets versions, so ensure they are left alive.
if ( m_staticBox )
{
// Notice that we must make a copy of the list as it will be changed by
// Reparent() calls in the loop.
const wxWindowList children = m_staticBox->GetChildren();
wxWindow* const parent = m_staticBox->GetParent();
for ( wxWindowList::const_iterator i = children.begin();
i != children.end();
++i )
{
(*i)->Reparent(parent);
}
delete m_staticBox;
}
m_staticBox->WXDestroyWithoutChildren();
}
void wxStaticBoxSizer::RecalcSizes()