Bug 1034915 - Don't explicitly call delete on nsExtensibleStringBundle. r=ehsan

This commit is contained in:
Andrew McCreight 2014-07-08 13:46:24 -07:00
parent 1779f79346
commit f707412721
2 changed files with 9 additions and 20 deletions

View File

@ -637,19 +637,16 @@ nsStringBundleService::CreateExtensibleBundle(const char* aCategory,
nsIStringBundle** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nullptr;
nsresult res;
nsRefPtr<nsExtensibleStringBundle> bundle = new nsExtensibleStringBundle();
nsExtensibleStringBundle * bundle = new nsExtensibleStringBundle();
res = bundle->Init(aCategory, this);
nsresult res = bundle->Init(aCategory, this);
if (NS_FAILED(res)) {
delete bundle;
return res;
}
res = bundle->QueryInterface(NS_GET_IID(nsIStringBundle), (void**) aResult);
if (NS_FAILED(res)) delete bundle;
return res;
}

View File

@ -53,35 +53,27 @@ public:
class nsExtensibleStringBundle;
namespace mozilla {
template<>
struct HasDangerousPublicDestructor<nsExtensibleStringBundle>
{
static const bool value = true;
};
}
/**
* An extensible implementation of the StringBundle interface.
*
* @created 28/Dec/1999
* @author Catalin Rotaru [CATA]
*/
class nsExtensibleStringBundle : public nsIStringBundle
class nsExtensibleStringBundle MOZ_FINAL : public nsIStringBundle
{
NS_DECL_ISUPPORTS
NS_DECL_NSISTRINGBUNDLE
nsresult Init(const char * aCategory, nsIStringBundleService *);
private:
nsCOMArray<nsIStringBundle> mBundles;
bool mLoaded;
public:
nsExtensibleStringBundle();
private:
virtual ~nsExtensibleStringBundle();
nsCOMArray<nsIStringBundle> mBundles;
bool mLoaded;
};