From: Julian Smart Date: Sat, 22 Oct 2005 08:05:19 +0000 (+0000) Subject: Replace node deletion with Erase X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/efbf673503f863343b5300a2ec41b36572dd0ac9?ds=sidebyside Replace node deletion with Erase git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35979 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 57846be1f7..2257206c1b 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -174,9 +174,10 @@ bool wxRichTextCompositeObject::RemoveChild(wxRichTextObject* child, bool delete wxRichTextObjectList::compatibility_iterator node = m_children.Find(child); if (node) { + wxRichTextObject* obj = node->GetData(); + m_children.Erase(node); if (deleteChild) - delete node->GetData(); - delete node; + delete obj; return true; } @@ -195,7 +196,7 @@ bool wxRichTextCompositeObject::DeleteChildren() child->Dereference(); // Only delete if reference count is zero node = node->GetNext(); - delete oldNode; + m_children.Erase(oldNode); } return true;