Permalink
Browse files

Fixed refcounting bug in new string implementation

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Oct 21, 2014
1 parent 9323ae4 commit a9dcbfe28625673f4d13bc5b3cde694c24062e19
Showing with 15 additions and 803 deletions.
  1. +15 −12 qtools/qcstring.h
  2. +0 −791 qtools/rcstring.h
View
@@ -498,19 +498,22 @@ class QCString
}
StringRep &operator=(const StringRep &s)
{
if (!u.s.isShort)
{
u.l.d->dispose();
}
if (s.u.s.isShort) // copy by value
{
u.s = s.u.s;
}
else // copy by reference
if (&s!=this)
{
u.l.isShort=FALSE;
u.l.d = s.u.l.d;
u.l.d->refCount++;
if (!u.s.isShort)
{
u.l.d->dispose();
}
if (s.u.s.isShort) // copy by value
{
u.s = s.u.s;
}
else // copy by reference
{
u.l.isShort=FALSE;
u.l.d = s.u.l.d;
u.l.d->refCount++;
}
}
return *this;
}
Oops, something went wrong.

0 comments on commit a9dcbfe

Please sign in to comment.