File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050#include < string>
5151#include < vector>
5252
53+ // Forward declaration for testing.
54+ struct ValueTest ;
55+
5356#ifdef JSONCPP_HAS_STRING_VIEW
5457#include < string_view>
5558#endif
@@ -201,6 +204,7 @@ class JSON_API StaticString {
201204 */
202205class JSON_API Value {
203206 friend class ValueIteratorBase ;
207+ friend struct ::ValueTest;
204208
205209public:
206210 using Members = std::vector<String>;
Original file line number Diff line number Diff line change @@ -301,6 +301,9 @@ Value::CZString& Value::CZString::operator=(const CZString& other) {
301301}
302302
303303Value::CZString& Value::CZString::operator =(CZString&& other) noexcept {
304+ if (cstr_ && storage_.policy_ == duplicate) {
305+ releasePrefixedStringValue (const_cast <char *>(cstr_));
306+ }
304307 cstr_ = other.cstr_ ;
305308 if (other.cstr_ ) {
306309 storage_.policy_ = other.storage_ .policy_ ;
You can’t perform that action at this time.
0 commit comments