Fix bugs in wxEnumProperty introduced by r76562.

The compilation fixes introduced run-time fixes due to not account for the use
of NULL pointers (which are not accepted as choices cache but are accepted as
choices values, go figure).

Closes #16266.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-18 00:24:13 +00:00
parent 0141cbe551
commit 31b8c29fcd
2 changed files with 6 additions and 3 deletions

View File

@@ -1683,13 +1683,15 @@ static const long gs_cp_es_syscursors_values[NUM_CURSORS] = {
IMPLEMENT_DYNAMIC_CLASS(wxCursorProperty, wxEnumProperty) IMPLEMENT_DYNAMIC_CLASS(wxCursorProperty, wxEnumProperty)
static wxPGChoices gs_wxCursorProperty_choicesCache;
wxCursorProperty::wxCursorProperty( const wxString& label, const wxString& name, wxCursorProperty::wxCursorProperty( const wxString& label, const wxString& name,
int value ) int value )
: wxEnumProperty( label, : wxEnumProperty( label,
name, name,
gs_cp_es_syscursors_labels, gs_cp_es_syscursors_labels,
gs_cp_es_syscursors_values, gs_cp_es_syscursors_values,
NULL, &gs_wxCursorProperty_choicesCache,
value ) value )
{ {
m_flags |= wxPG_PROP_STATIC_CHOICES; // Cursor selection cannot be changed. m_flags |= wxPG_PROP_STATIC_CHOICES; // Cursor selection cannot be changed.

View File

@@ -1130,9 +1130,10 @@ wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name,
} }
else else
{ {
for ( ; untranslatedLabels; untranslatedLabels++, values++ ) for ( int i = 0; *untranslatedLabels; untranslatedLabels++ )
{ {
m_choices.Add(wxGetTranslation(*untranslatedLabels), *values); const long val = values ? *values++ : i++;
m_choices.Add(wxGetTranslation(*untranslatedLabels), val);
} }
if ( GetItemCount() ) if ( GetItemCount() )