File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -528,12 +528,19 @@ int i;
528
528
529
529
// delete plugins
530
530
531
- for (PluginListIterator pit = m_PluginList.begin ();
532
- pit != m_PluginList.end ();
533
- ++pit)
534
- delete *pit;
531
+ PluginListIterator pit = m_PluginList.begin ();
532
+
533
+ // we have to do it this way, because otherwise if a plugin attempts to access the
534
+ // plugin list (eg. BroadcastPlugin, Trace) during the delete operation, then it
535
+ // may call a plugin that was deleted a moment ago, but is still in the list.
536
+
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
+ }
535
543
536
- m_PluginList.clear ();
537
544
538
545
CloseLog (); // this writes out the log file postamble as well
539
546
You can’t perform that action at this time.
0 commit comments