From: Adam Tkac Date: Mon, 22 Nov 2010 14:53:23 +0000 (+0000) Subject: [Bugfix] Don't operate on erased iterator (ID 3112731). X-Git-Tag: v1.0.90~114 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=684ca1df03763135bd2cf90b07b77517e57f12f3;p=tigervnc.git [Bugfix] Don't operate on erased iterator (ID 3112731). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4204 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/common/rfb/ScreenSet.h b/common/rfb/ScreenSet.h index 6f5188ca..f2df156c 100644 --- a/common/rfb/ScreenSet.h +++ b/common/rfb/ScreenSet.h @@ -74,8 +74,9 @@ namespace rfb { inline void add_screen(const Screen screen) { screens.push_back(screen); }; inline void remove_screen(rdr::U32 id) { - std::list::iterator iter; - for (iter = screens.begin();iter != screens.end();++iter) { + std::list::iterator iter, nextiter; + for (iter = screens.begin();iter != screens.end();iter = nextiter) { + nextiter = ++iter; if (iter->id == id) screens.erase(iter); }