Opened 6 years ago

Closed 6 years ago

#16589 closed defect (fixed)

wxGTK wxDatePickerCtrl fails in widgets sample

Reported by: kosenko Owned by: vadz
Priority: normal Milestone:
Component: wxGTK Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no


wxDatePickerCtrl control has segmentation fault during creation in widgets sample after r77756.
m_combo is NULL in wxDatePickerCtrlGeneric::DoGetBestSize() during wxDatePickerCtrlGeneric::Create() execution.

  • include/wx/compositewin.h

    diff --git include/wx/compositewin.h include/wx/compositewin.h
    103103        // The child layout almost invariably depends on the layout direction,
    104104        // so redo it when it changes.
    105         this->SetSize(-1, -1, -1, -1, wxSIZE_AUTO | wxSIZE_FORCE);
     105        //this->SetSize(-1, -1, -1, -1, wxSIZE_AUTO | wxSIZE_FORCE);
    106106    }
    108108#if wxUSE_TOOLTIPS

Change History (1)

comment:1 Changed 6 years ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

In 77890:

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.

Note: See TracTickets for help on using tickets.