Must clear property selection in wxPGProperty::SetChoices() or risk a crash
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2109,10 +2109,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxClientData *GetClientObject() const { return m_clientObject; }
|
wxClientData *GetClientObject() const { return m_clientObject; }
|
||||||
|
|
||||||
/** Sets new set of choices for property.
|
/**
|
||||||
|
Sets new set of choices for the property.
|
||||||
|
|
||||||
@remarks
|
@remarks This operation deselects the property and clears its
|
||||||
This operation clears the property value.
|
value.
|
||||||
*/
|
*/
|
||||||
bool SetChoices( wxPGChoices& choices );
|
bool SetChoices( wxPGChoices& choices );
|
||||||
|
|
||||||
|
@@ -1364,9 +1364,10 @@ public:
|
|||||||
void SetCell( int column, const wxPGCell& cell );
|
void SetCell( int column, const wxPGCell& cell );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets new set of choices for property.
|
Sets new set of choices for the property.
|
||||||
|
|
||||||
@remarks This operation clears the property value.
|
@remarks This operation deselects the property and clears its
|
||||||
|
value.
|
||||||
*/
|
*/
|
||||||
bool SetChoices( wxPGChoices& choices );
|
bool SetChoices( wxPGChoices& choices );
|
||||||
|
|
||||||
|
@@ -1911,6 +1911,12 @@ void wxPGProperty::SetChoiceSelection( int newValue )
|
|||||||
|
|
||||||
bool wxPGProperty::SetChoices( wxPGChoices& choices )
|
bool wxPGProperty::SetChoices( wxPGChoices& choices )
|
||||||
{
|
{
|
||||||
|
// Property must be de-selected first (otherwise choices in
|
||||||
|
// the control would be de-synced with true choices)
|
||||||
|
wxPropertyGrid* pg = GetGrid();
|
||||||
|
if ( pg && pg->GetSelection() == this )
|
||||||
|
pg->ClearSelection();
|
||||||
|
|
||||||
m_choices.Assign(choices);
|
m_choices.Assign(choices);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user