Bug 797982 - investigation patch for StringBuilder::Unit crash, r=hsivonen

This commit is contained in:
Olli Pettay 2012-10-12 14:14:15 +03:00
parent ee9067e40d
commit d8f6c4ce3e

View File

@ -647,12 +647,16 @@ private:
class Unit
{
public:
Unit() : mType(eUnknown), mLength(0) {}
Unit() : mAtom(nullptr), mType(eUnknown), mLength(0)
{
MOZ_COUNT_CTOR(StringBuilder::Unit);
}
~Unit()
{
if (mType == eString || mType == eStringWithEncode) {
delete mString;
}
MOZ_COUNT_DTOR(StringBuilder::Unit);
}
enum Type
@ -677,7 +681,15 @@ private:
uint32_t mLength;
};
public:
StringBuilder() : mLast(this), mLength(0) {}
StringBuilder() : mLast(this), mLength(0)
{
MOZ_COUNT_CTOR(StringBuilder);
}
~StringBuilder()
{
MOZ_COUNT_DTOR(StringBuilder);
}
void Append(nsIAtom* aAtom)
{
@ -807,6 +819,7 @@ private:
StringBuilder(StringBuilder* aFirst)
: mLast(nullptr), mLength(0)
{
MOZ_COUNT_CTOR(StringBuilder);
aFirst->mLast->mNext = this;
aFirst->mLast = this;
}