From a86162f2877d6576b2a4accec00372f246629869 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 13 Jul 2015 18:02:44 -0400 Subject: [PATCH] Fix incorrect iteration when destructing modelockimpls --- modules/commands/cs_mode.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index b11bc8862..e801b3959 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -44,10 +44,11 @@ struct ModeLocksImpl : ModeLocks ~ModeLocksImpl() { - for (ModeList::iterator it = this->mlocks->begin(); it != this->mlocks->end();) + ModeList modelist; + mlocks->swap(modelist); + for (ModeList::iterator it = modelist.begin(); it != modelist.end(); ++it) { ModeLock *ml = *it; - ++it; delete ml; } }