Skip to content

Commit

Permalink
Improvement to plugin deletion problem
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Oct 28, 2010
1 parent f41ba46 commit cc89eff
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions doc_construct.cpp
Expand Up @@ -522,25 +522,20 @@ int i;
udpSocketIterator++)
delete udpSocketIterator->second;

// delete chat sessions
// delete chat sessions

DELETE_LIST (m_ChatList);

// delete plugins

PluginListIterator pit = m_PluginList.begin ();
// delete plugins

// we have to do it this way, because otherwise if a plugin attempts to access the
// plugin list (eg. BroadcastPlugin, Trace) during the delete operation, then it
// may call a plugin that was deleted a moment ago, but is still in the list.

while (pit != m_PluginList.end ())
{
CPlugin * pPlugin = *pit; // get this one
pit = m_PluginList.erase (pit); // remove from list, move onto next one
delete pPlugin; // delete *this* one
}

for (PluginListIterator pit = m_PluginList.begin ();
pit != m_PluginList.end ();
pit = m_PluginList.erase (pit)) // erase from list and get next one
delete *pit; // delete *this* one

CloseLog (); // this writes out the log file postamble as well

Expand Down

0 comments on commit cc89eff

Please sign in to comment.