Avoid calling SetSize() from wxCompositeWindow::Create() under wxGTK.
This was unexpected and resulted in a crash in the case of wxDatePickerCtrl. And while this particular crash could be fixed just by checking for the pointers validity in the overridden wxDatePickerCtrl::SetSize(), it seems better to avoid such unexpected calls to SetSize(), especially as they only happen under wxGTK, which calls SetLayoutDirection(wxLayout_Default) from its wxWindow::Create(), and so wouldn't be found by any amount of testing under other platforms. Closes #16589. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -102,7 +102,14 @@ public:
|
||||
|
||||
// The child layout almost invariably depends on the layout direction,
|
||||
// so redo it when it changes.
|
||||
this->SetSize(-1, -1, -1, -1, wxSIZE_AUTO | wxSIZE_FORCE);
|
||||
//
|
||||
// However avoid doing it when we're called from wxWindow::Create() in
|
||||
// wxGTK as the derived window is not fully created yet and calling its
|
||||
// SetSize() may be unexpected. This does mean that any future calls to
|
||||
// SetLayoutDirection(wxLayout_Default) wouldn't result in a re-layout
|
||||
// neither, but then we're not supposed to be called with it at all.
|
||||
if ( dir != wxLayout_Default )
|
||||
this->SetSize(-1, -1, -1, -1, wxSIZE_AUTO | wxSIZE_FORCE);
|
||||
}
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
|
Reference in New Issue
Block a user