From df1d13a15534fe090feec4b45527f436972e9faf Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Wed, 4 Dec 2013 10:01:50 +0100 Subject: [PATCH] sharedVector: count > capacity bugfix --- pvDataApp/misc/sharedVector.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvDataApp/misc/sharedVector.h b/pvDataApp/misc/sharedVector.h index d0bd6cb..c59c89e 100644 --- a/pvDataApp/misc/sharedVector.h +++ b/pvDataApp/misc/sharedVector.h @@ -357,6 +357,7 @@ public: void reserve(size_t i) { if(this->unique() && i<=this->m_total) return; + size_t new_count = std::min(this->m_count, i); _E_non_const* temp=new _E_non_const[i]; try{ std::copy(begin(), end(), temp); @@ -366,8 +367,8 @@ public: throw; } this->m_offset = 0; + this->m_count = new_count; this->m_total = i; - // m_count is unchanged } /** @brief Grow or shrink array