Fix deleting pending editor controls if wxPG is destructed from within its own event handler.

If wxPG dtor is invoked from within event handler then deleting its pending editor controls should be delegated to the global idle event handler.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek
2014-10-18 09:37:33 +00:00
parent c234f5078f
commit f858486cec

View File

@@ -539,8 +539,26 @@ wxPropertyGrid::~wxPropertyGrid()
wxS("Close(false).)") );
}
// Delete pending editor controls
DeletePendingObjects();
if ( m_processedEvent )
{
// We are inside event handler and we cannot delete
// editor objects immediatelly. They have to be deleted
// later on in the global idle handler.
#if !WXWIN_COMPATIBILITY_3_0
while ( !m_deletedEditorObjects.empty() )
{
wxObject* obj = m_deletedEditorObjects.back();
m_deletedEditorObjects.pop_back();
wxPendingDelete.Append(obj);
}
#endif
}
else
{
// Delete pending editor controls
DeletePendingObjects();
}
if ( m_doubleBuffer )
delete m_doubleBuffer;