Prevent duplicating wxPG property items on the list of items for deferred deletion/removal.
It is necessary to prevent duplicating items on the list of items to be deleted/removed later on (in wxPropertyGrid::OnIdle) to avoid crashes when it would be attempted to delete/remove already deleted/removed item. See #16222. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1830,10 +1830,21 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
|
||||
// Must defer deletion? Yes, if handling a wxPG event.
|
||||
if ( pg && pg->m_processedEvent )
|
||||
{
|
||||
// Prevent adding duplicates to the lists.
|
||||
if ( doDelete )
|
||||
pg->m_deletedProperties.push_back(item);
|
||||
{
|
||||
if ( pg->m_deletedProperties.Index(item) == wxNOT_FOUND )
|
||||
{
|
||||
pg->m_deletedProperties.push_back(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
pg->m_removedProperties.push_back(item);
|
||||
{
|
||||
if ( pg->m_removedProperties.Index(item) == wxNOT_FOUND )
|
||||
{
|
||||
pg->m_removedProperties.push_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
// Rename the property so it won't remain in the way
|
||||
// of the user code.
|
||||
|
Reference in New Issue
Block a user