From f02e31f2fca7299695e006f0a0bffbebe115d8e9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 30 May 2010 13:10:44 +0000 Subject: Fix non-const version of Common::String::begin. Common::String::begin now assures the storage is a unique one, i.e. there are no other Common::String objects pointing at it. This allows for safe use of the writable iterators (and thus fixes the test case added with my last commit) svn-id: r49323 --- common/str.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/str.h b/common/str.h index 12e2b0d2d3..74bcb42264 100644 --- a/common/str.h +++ b/common/str.h @@ -222,6 +222,12 @@ public: typedef const char * const_iterator; iterator begin() { + // Since the user could potentionally + // change the string via the returned + // iterator we have to assure we are + // pointing to an unique storage. + makeUnique(); + return _str; } -- cgit v1.2.3