mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Fix assignment operator
This commit is contained in:
parent
591253d5b5
commit
55ac3dca70
1 changed files with 9 additions and 5 deletions
|
|
@ -103,13 +103,17 @@ 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)
|
||||||
{
|
{
|
||||||
delete [] mString;
|
if (&other != this)
|
||||||
|
{
|
||||||
|
delete [] mString;
|
||||||
|
|
||||||
mLength = other.mLength;
|
mLength = other.mLength;
|
||||||
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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue