Fix assignment operator

This commit is contained in:
Ben Payne 2015-02-10 23:53:15 -05:00
parent 591253d5b5
commit 55ac3dca70

View file

@ -103,7 +103,9 @@ struct UTF16Cache
dMemcpy(mString, other.mString, mLength * sizeof(UTF16)); dMemcpy(mString, other.mString, mLength * sizeof(UTF16));
} }
void operator =(const UTF16Cache &other) UTF16Cache & operator =(const UTF16Cache &other)
{
if (&other != this)
{ {
delete [] mString; delete [] mString;
@ -111,6 +113,8 @@ struct UTF16Cache
mString = new UTF16[mLength]; mString = new UTF16[mLength];
dMemcpy(mString, other.mString, mLength * sizeof(UTF16)); dMemcpy(mString, other.mString, mLength * sizeof(UTF16));
} }
return *this;
}
~UTF16Cache() ~UTF16Cache()
{ {