Bug 778501 Part 1: mLanguage should be an nsCOMPtr r=roc

This commit is contained in:
David Zbarsky 2012-07-29 21:29:23 -07:00
parent ba6eb75773
commit 31275596fb
2 changed files with 3 additions and 6 deletions

View File

@ -297,7 +297,6 @@ nsPresContext::~nsPresContext()
this);
NS_IF_RELEASE(mDeviceContext);
NS_IF_RELEASE(mLanguage);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsPresContext)
@ -1121,14 +1120,12 @@ void
nsPresContext::UpdateCharSet(const nsCString& aCharSet)
{
if (mLangService) {
NS_IF_RELEASE(mLanguage);
mLanguage = mLangService->LookupCharSet(aCharSet.get()).get(); // addrefs
mLanguage = mLangService->LookupCharSet(aCharSet.get());
// this will be a language group (or script) code rather than a true language code
// bug 39570: moved from nsLanguageAtomService::LookupCharSet()
if (mLanguage == nsGkAtoms::Unicode) {
NS_RELEASE(mLanguage);
NS_IF_ADDREF(mLanguage = mLangService->GetLocaleLanguage());
mLanguage = mLangService->GetLocaleLanguage();
}
ResetCachedFontPrefs();
}

View File

@ -1105,7 +1105,7 @@ protected:
// This may in fact hold a langGroup such as x-western rather than
// a specific language, however (e.g, if it is inferred from the
// charset rather than explicitly specified as a lang attribute).
nsIAtom* mLanguage; // [STRONG]
nsCOMPtr<nsIAtom> mLanguage;
public:
// The following are public member variables so that we can use them