mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 931571, part 13 - Add a destructor for nsDiscriminatedUnion. r=froydnj
The existing nsDiscriminateUnions either always call Cleanup() when they are about to go away, or they only handle scalar values so it is safe to call Cleanup() on them without worrying about another discriminated union having taken over any memory owned by this union.
This commit is contained in:
parent
0994e4e4ed
commit
13e2d3a560
@ -603,7 +603,6 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
|
||||
case nsIDataType::VTYPE_EMPTY:
|
||||
default:
|
||||
NS_ERROR("bad type in array!");
|
||||
du.Cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -613,7 +612,6 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
|
||||
conversionType, pid,
|
||||
du.u.array.mArrayCount, pErr);
|
||||
|
||||
du.Cleanup();
|
||||
return success;
|
||||
}
|
||||
case nsIDataType::VTYPE_EMPTY_ARRAY:
|
||||
|
@ -1721,11 +1721,6 @@ nsVariant::nsVariant()
|
||||
#endif
|
||||
}
|
||||
|
||||
nsVariant::~nsVariant()
|
||||
{
|
||||
mData.Cleanup();
|
||||
}
|
||||
|
||||
// For all the data getters we just forward to the static (and sharable)
|
||||
// 'ConvertTo' functions.
|
||||
|
||||
|
@ -32,6 +32,7 @@ class nsDiscriminatedUnion
|
||||
public:
|
||||
|
||||
nsDiscriminatedUnion() : mType(nsIDataType::VTYPE_EMPTY) {}
|
||||
~nsDiscriminatedUnion() { Cleanup(); }
|
||||
|
||||
void Cleanup();
|
||||
|
||||
@ -181,7 +182,7 @@ public:
|
||||
nsVariant();
|
||||
|
||||
private:
|
||||
~nsVariant();
|
||||
~nsVariant() {};
|
||||
|
||||
protected:
|
||||
nsDiscriminatedUnion mData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user