First check whether it is attempted to delete the root property

Because wxPGRootProperty has no parent, just like an unattached (waiting
for deletion) child wxPGProperty, so we have to first check whether
the property is the root and next whether it has a parent.
This commit is contained in:
Artur Wieczorek 2019-10-23 18:05:39 +02:00
parent a60c5b36fe
commit ec42121235

View File

@ -1839,12 +1839,12 @@ bool wxPropertyGridPageState::IsChildCategory(wxPGProperty* p,
void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
{
wxCHECK_RET(item != &m_regularArray && item != m_abcArray,
wxS("wxPropertyGrid: Do not attempt to remove the root item."));
wxCHECK_RET( item->GetParent(),
wxS("wxPropertyGrid: This property was already deleted.") );
wxCHECK_RET( item != &m_regularArray && item != m_abcArray,
wxS("wxPropertyGrid: Do not attempt to remove the root item.") );
wxPGProperty* parent = item->GetParent();
wxCHECK_RET( !parent->HasFlag(wxPG_PROP_AGGREGATE),