Closed Bug 56744 Opened 25 years ago Closed 25 years ago

CompositeDataSourceImpl::Release doesn't always work

Categories

(Core Graveyard :: RDF, defect, P2)

x86
Linux
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Keywords: memory-leak)

Attachments

(3 files)

If I run ./mozilla -ProfileManager and click Exit, 2 of the 10-11 nsVoidArray leaked (the first two by serial number) are the nsVoidArray that are part of a CompositeDataSourceImpl. This CompositeDataSourceImpl doesn't show up in the leak stats, but it wasn't deleted because CompositeDataSourceImpl::Release doesn't always work. In particular, if mDataSources.Count() == 0, it doesn't |delete this|. The proposed fix I'll attach is just a slightly modified version of my patch to bug 44621. waterson: What do you think?
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: --- → mozilla0.9
looks good; r=waterson
r=waterson, for real this time!
would prefer |NS_STATIC_CAST(PRInt32*, &mRefCnt)| in the two places where you use an old-style cast
When I change it to NS_STATIC_CAST(PRInt32 *, ...), I get: /builds/seamonkey/mozilla/rdf/base/src/nsCompositeDataSource.cpp: In method `nsrefcnt CompositeDataSourceImpl::Release ()': /builds/seamonkey/mozilla/rdf/base/src/nsCompositeDataSource.cpp:572: invalid static_cast from type `nsrefcnt *' to type `PRInt32 *' /builds/seamonkey/mozilla/rdf/base/src/nsCompositeDataSource.cpp:586: invalid static_cast from type `nsrefcnt *' to type `PRInt32 *' gmake[2]: *** [nsCompositeDataSource.o] Error 1 If I make the static cast to PRUint32 (which is what nsrefcnt is already, so it's kinda pointless), I get: /builds/seamonkey/mozilla/rdf/base/src/nsCompositeDataSource.cpp: In method `nsrefcnt CompositeDataSourceImpl::Release ()': /builds/seamonkey/mozilla/rdf/base/src/nsCompositeDataSource.cpp:572: cannot convert `PRUint32 *' to `PRInt32 *' for argument `1' to `PR_AtomicDecrement (PRInt32 *)' /builds/seamonkey/mozilla/rdf/base/src/nsCompositeDataSource.cpp:586: cannot convert `PRUint32 *' to `PRInt32 *' for argument `1' to `PR_AtomicAdd (PRInt32 *, int)' gmake[2]: *** [nsCompositeDataSource.o] Error 1 I'm using RedHat's gcc "2.96". Any better ideas, or should I just leave it as it was?
scc, did you mean NS_REINTERPRET_CAST? I thought that's what you needed to go between unrelated types...
Right :-) even though signed and unsigned are convertable to each other, pointers to the two types are unrelated, and a reinterpret cast is required. |NS_STATIC_CAST| was the wrong thing for me to say, sorry. sr=scc
Fix checked in 2000-10-29 13:32-0800.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
verified
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: