Skip to content

Commit cc89eff

Browse files
committed
Improvement to plugin deletion problem
1 parent f41ba46 commit cc89eff

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

doc_construct.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -522,25 +522,20 @@ int i;
522522
udpSocketIterator++)
523523
delete udpSocketIterator->second;
524524

525-
// delete chat sessions
525+
// delete chat sessions
526526

527527
DELETE_LIST (m_ChatList);
528528

529-
// delete plugins
530-
531-
PluginListIterator pit = m_PluginList.begin ();
529+
// delete plugins
532530

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

537-
while (pit != m_PluginList.end ())
538-
{
539-
CPlugin * pPlugin = *pit; // get this one
540-
pit = m_PluginList.erase (pit); // remove from list, move onto next one
541-
delete pPlugin; // delete *this* one
542-
}
543-
535+
for (PluginListIterator pit = m_PluginList.begin ();
536+
pit != m_PluginList.end ();
537+
pit = m_PluginList.erase (pit)) // erase from list and get next one
538+
delete *pit; // delete *this* one
544539

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

0 commit comments

Comments
 (0)