Allow clearing wxPG from within wxPG event handlers.

If wxPG::Clear is called from within event handler then it is not possible to delete all property items directly because some vital internal wxPG data are still in use. In this case it is necessary to put all items on the list for deferred deletion in wxPG idle state.

Closes #16222.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek
2014-07-11 17:25:39 +00:00
parent c16808c380
commit 0228d578ee

View File

@@ -286,18 +286,33 @@ void wxPropertyGridPageState::DoClear()
m_selection.clear();
}
m_regularArray.Empty();
if ( m_abcArray )
m_abcArray->Empty();
// If handling wxPG event then every property item must be
// deleted individually (and with deferral).
if ( m_pPropGrid && m_pPropGrid->m_processedEvent )
{
wxPropertyGridIterator it;
for ( it = m_pPropGrid->GetIterator(wxPG_ITERATE_ALL);
!it.AtEnd();
it++ )
{
DoDelete(*it, true);
}
}
else
{
m_regularArray.Empty();
if ( m_abcArray )
m_abcArray->Empty();
m_dictName.clear();
m_dictName.clear();
m_currentCategory = NULL;
m_lastCaptionBottomnest = 1;
m_itemsAdded = 0;
m_currentCategory = NULL;
m_lastCaptionBottomnest = 1;
m_itemsAdded = 0;
m_virtualHeight = 0;
m_vhCalcPending = 0;
m_virtualHeight = 0;
m_vhCalcPending = 0;
}
}
// -----------------------------------------------------------------------