Closed Bug 11382 Opened 21 years ago Closed 21 years ago
Cnt Error in ns Service Manager Impl
I found that the reference counting(mRefCnt) for service components may be errorous. mRefCnt of all components be started as one after creating the instance by nsComponentManagerImpl::CreateInstance(). So, After registering a component as a service in the nsServiceManager, it will be two. In case of nsServiceManagerImpl::UnRegisterService(), do try to unload the component if mRefCnt of the component become 0. But, It always can't be zero beause mRefcnt is decremented as one in UnRegisterService(). So does it in GetService ()/ReleaseService(). Maybe, are there any other codes for helping this question? I don't know, I can't find them until now.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
I see your confusion. It is understandable. Let me try to explain it: Ref GetService(&service) 2 ReleaseService(service) 1 <- this is the service manager cache. Will go away only on XPCOMShutdown. Comming to Register/Unregister Service: Create the service somehow. 1 RegisterService(service) 2 <- servicemanager and caller NS_RELEASE(service) 1 <- servicemanager; caller has released their addref UnregisterService(service) 0 <- service manager releases the service from cache Let me know if this isnt clear or doesn't conform to the code.
Thats quite old stuff...verify if applicable, please?
You need to log in before you can comment on or make changes to this bug.