diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 62b68b0916..609870b89a 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -165,6 +165,13 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) : WidgetsPage(notebook) { + m_chkVert = NULL; + m_chkWrap = NULL; + m_spinbtn = NULL; + m_spinctrl = NULL; + m_textValue = NULL; + m_textMin = NULL; + m_textMax = NULL; imaglist->Add(wxBitmap(spinbtn_xpm)); // init everything @@ -410,6 +417,8 @@ void SpinBtnWidgetsPage::OnSpinBtnDown(wxCommandEvent& event) void SpinBtnWidgetsPage::OnSpinCtrl(wxCommandEvent& event) { + if (!m_spinctrl) + return; int value = event.GetInt(); wxASSERT_MSG( value == m_spinctrl->GetValue(), @@ -417,4 +426,4 @@ void SpinBtnWidgetsPage::OnSpinCtrl(wxCommandEvent& event) wxLogMessage(_T("Spin control value changed, now %d"), value); } -#endif \ No newline at end of file +#endif diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index f7b6eee18a..9f92ee77bd 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -816,7 +816,8 @@ wxString wxTextCtrl::GetValue() const else { actualsize = GetHandleSize( theText ) ; - strncpy( wxBuffer , *theText , actualsize ) ; + if (actualsize != 0) + strncpy( wxBuffer , *theText , actualsize ) ; DisposeHandle( theText ) ; } } diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index f7b6eee18a..9f92ee77bd 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -816,7 +816,8 @@ wxString wxTextCtrl::GetValue() const else { actualsize = GetHandleSize( theText ) ; - strncpy( wxBuffer , *theText , actualsize ) ; + if (actualsize != 0) + strncpy( wxBuffer , *theText , actualsize ) ; DisposeHandle( theText ) ; } }