Commit a9dcbfe2 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Fixed refcounting bug in new string implementation

parent 9323ae47
...@@ -497,6 +497,8 @@ public: ...@@ -497,6 +497,8 @@ public:
} }
} }
StringRep &operator=(const StringRep &s) StringRep &operator=(const StringRep &s)
{
if (&s!=this)
{ {
if (!u.s.isShort) if (!u.s.isShort)
{ {
...@@ -512,6 +514,7 @@ public: ...@@ -512,6 +514,7 @@ public:
u.l.d = s.u.l.d; u.l.d = s.u.l.d;
u.l.d->refCount++; u.l.d->refCount++;
} }
}
return *this; return *this;
} }
StringRep &operator=(const char *str) StringRep &operator=(const char *str)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment