nsPersistentProperties shutdown leak in uconv

RESOLVED FIXED in mozilla1.9beta1

Status

()

Core
Internationalization
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Nickolay_Ponomarev, Assigned: Nickolay_Ponomarev)

Tracking

({memory-leak})

Trunk
mozilla1.9beta1
x86
Windows XP
memory-leak
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Assignee)

Description

11 years ago
Created attachment 281982 [details] [diff] [review]
patch

http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/intl/uconv/src/nsWinCharset.cpp&rev=1.38&mark=70-71,78-80#68

This logic is just wrong. Currently on Windows InitInfo is called twice, once from the constructor and once (for the same nsPlatformCharset) from this stack:

uconv.dll!nsPlatformCharset::InitInfo()  Line 80	C++
uconv.dll!nsPlatformCharset::MapToCharset(inANSICodePage={...}, outCharset={...})  Line 107	C++
uconv.dll!nsPlatformCharset::GetDefaultCharsetForLocale(localeName={...}, oResult={...})  Line 157	C++
i18n.dll!nsCollationWin::Initialize(locale=0x033039a0)  Line 121	C++
i18n.dll!nsCollationFactory::CreateCollation(locale=0x033039a0, instancePtr=0x032e5eec)  Line 67	C++
places.dll!nsNavHistory::Init()  Line 365	C++
places.dll!nsNavHistoryConstructor(aOuter=0x00000000, aIID={...}, aResult=0x0012e9f4)  Line 9	C++
xpcom_core.dll!nsGenericFactory::CreateInstance(aOuter=0x00000000, aIID={...}, aResult=0x0012e9f4)  Line 80	C++
xpcom_core.dll!nsComponentManagerImpl::CreateInstance(aClass={...}, aDelegate=0x00000000, aIID={...}, aResult=0x0012e9f4)  Line 1714	C++
xpcom_core.dll!nsComponentManagerImpl::GetService(aClass={...}, aIID={...}, result=0x0012eaa8)  Line 1926	C++
xpc3250.dll!nsJSCID::GetService(_retval=0x0012ec98)  Line 899	C++
xpcom_core.dll!NS_InvokeByIndex_P(that=0x0000000b, methodIndex=0x00000001, paramCount=0x0012ec98, params=0x0042f7bb)  Line 102	C++
xpc3250.dll!XPCWrappedNative::CallMethod(ccx={...}, mode=0x0000000b)  Line 2326	C++
xpc3250.dll!XPCWrappedNative::CallMethod(ccx={...}, mode=CALL_METHOD)  Line 2326	C++
xpc3250.dll!XPC_WN_CallMethod(cx=0x0326a740, obj=JSObject [... slots], argc=0x00000001, argv=0x032cf1f0, vp=0x0012ef48)  Line 1467	C++
js3250.dll!js_Invoke(cx=0x0326a740, argc=0x00000001, vp=0x032cf1e8, flags=0x00000000)  Line 1382	C
js3250.dll!js_Interpret(cx=0x0326a740, pc=0x022fce7f, result=0x0012f618)  Line 4092	C
js3250.dll!js_Invoke(cx=0x0326a740, argc=0x00000003, vp=0x032cf040, flags=0x00000002)  Line 1402	C
xpc3250.dll!nsXPCWrappedJSClass::CallMethod(wrapper=0x023169f0, methodIndex=0x0003, info=0x00dc33e8, nativeParams=0x0012f914)  Line 1443	C++
xpc3250.dll!nsXPCWrappedJS::CallMethod(methodIndex=0x0003, info=0x00dc33e8, params=0x0012f914)  Line 566	C++
xpcom_core.dll!PrepareAndDispatch(self=0x02316820, methodIndex=0x00000003, args=0x0012f9d4, stackBytesToPop=0x0012f9c4)  Line 114	C++
xpcom_core.dll!SharedStub()  Line 142	C++
xpcom_core.dll!nsObserverList::NotifyObservers(aSubject=0x02316820, aTopic=0x00000000, someData=0x100382a4)  Line 129	C++
xpcom_core.dll!nsObserverList::NotifyObservers(aSubject=0x00000000, aTopic=0x100382a4, someData=0x00000000)  Line 129	C++
xpcom_core.dll!nsObserverService::NotifyObservers(aSubject=0x00000000, aTopic=0x100382a4, someData=0x00000000)  Line 184	C++
xul.dll!XRE_main(argc=0x00000004, argv=0x00bf96a8, aAppData=0x00bf9ae0)  Line 3097	C++
firefox.exe!main(argc=0x00000004, argv=0x00bf96a8)  Line 153	C++
firefox.exe!__tmainCRTStartup()  Line 597	C
firefox.exe!mainCRTStartup()  Line 414	C

This causes gCnt to up to 2 and never become 0, leading to the nsGREResProperties and thus nsPersistentProperties (stored in nsCOMPtr there) leak.
Attachment #281982 - Flags: review?(smontagu)
(Assignee)

Updated

11 years ago
Assignee: smontagu → asqueella
Target Milestone: --- → mozilla1.9 M9

Updated

11 years ago
Attachment #281982 - Flags: review?(smontagu) → review+
(Assignee)

Updated

11 years ago
Attachment #281982 - Flags: approval1.9?

Updated

11 years ago
Attachment #281982 - Flags: approval1.9? → approval1.9+
(Assignee)

Updated

11 years ago
Keywords: checkin-needed
Are you going to check this in, asquella?
(Assignee)

Comment 2

11 years ago
I'm not sure when I'll be at a computer with the necessary tools, so please check this in for me. Not sure if it needs an extra approval now, could you check on IRC?
(In reply to comment #2)
> I'm not sure when I'll be at a computer with the necessary tools, so please
> check this in for me.

Ok, sure. Will do later today.

> Not sure if it needs an extra approval now, could you
> check on IRC?

No extra approval needed. damons is an endgame driver, so he's fine as an approver even now.
Checking in intl/uconv/src/nsWinCharset.cpp;
/cvsroot/mozilla/intl/uconv/src/nsWinCharset.cpp,v  <--  nsWinCharset.cpp
new revision: 1.39; previous revision: 1.38
done
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.