From a424a3cb04f16429e68eb6c21a241072abdfa188 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 27 Sep 2016 16:37:44 +0100 Subject: [PATCH] Fix lifetime of mutex lock in debug iterator * include/debug/safe_iterator.h (_Safe_iterator::operator++()): Fix lifetime of lock. From-SVN: r240549 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/debug/safe_iterator.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 80ca177e7dc4..4a20ad942f5f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2016-09-27 Jonathan Wakely + + * include/debug/safe_iterator.h (_Safe_iterator::operator++()): Fix + lifetime of lock. + 2016-09-20 Jonathan Wakely * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__) diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index 1eea238b97ac..6e3113ae4244 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -329,7 +329,7 @@ namespace __gnu_debug _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock(this->_M_get_mutex()); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); ++base(); return *this; }