Closed Bug 3178 Opened 26 years ago Closed 26 years ago

nsServiceManager::ReleaseService cannot handle different IID which share the same CID

Categories

(Core :: XPCOM, defect, P2)

All
Windows NT
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: ftang, Assigned: warrensomebody)

Details

I got an assertion in the nsServiceManager::RelaseService(). How to reproduce it- nsServiceManager::GetService(kCID1CID, kIID1IID, (nsISupport**) &t1); nsServiceManager::GetService(kCID1CID, kIID2IID, (nsISupport**) &t2); nsServiceManager::ReleaseService(kCID1CID, kIID2IID, (nsISupport**) &t2); nsServiceManager::ReleaseService(kCID1CID, kIID1IID, (nsISupport**) &t1); It will assert in one of the ReleaseService call. The problem is the service manager use the CID (not the CID + IID) as a key to get the service, but the nsISupports could be different object , depend on IID (even they are implemented by the same class, the QueryInterface will return a different pointer). The assertion failed in (entry->mService == service) because the entry is for the first kIID1IID but the service is t2. The assertion is valid becuase it got a wrong entry, the problem is the Get method should take account of both CID and IID, not just CID. This is break in my self test code mozilla/intl/lwbrk/tests/TestLineBreak.cpp in that case first IID is the kILineBreakFactory and the second one is kIWordBreakFactory. I will check in ASAP. (not yet)
OK, I have check in the sample code which cause this problem. Look at mozilla/intl/lwbrk/tests/TestLineBreak.cpp and comment out the line #define WORD_AROUND_SERVICE_MANAGER_ASSERT and rebuild it. Run TestLineBreak will show you that assert.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Frank removed the offending assertion.
You need to log in before you can comment on or make changes to this bug.