remove the object from wxPendingDelete list before deleting it to avoid infinite loop if DeletePendingObject() is reentered from object dtor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-08-25 15:49:11 +00:00
parent 449210a44c
commit 73865dad6e

View File

@ -366,11 +366,14 @@ void wxAppBase::DeletePendingObjects()
{
wxObject *obj = node->GetData();
delete obj;
if (wxPendingDelete.Member(obj))
// remove it from the list first so that if we get back here somehow
// during the object deletion (e.g. wxYield called from its dtor) we
// wouldn't try to delete it the second time
if ( wxPendingDelete.Member(obj) )
wxPendingDelete.Erase(node);
delete obj;
// Deleting one object may have deleted other pending
// objects, so start from beginning of list again.
node = wxPendingDelete.GetFirst();