From ec421212352534b3a9b34023f521f52ffd7dddc9 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 23 Oct 2019 18:05:39 +0200 Subject: [PATCH] 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. --- src/propgrid/propgridpagestate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index f25f966404..99bccbefea 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -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),