Mike Hearn wrote:
Sounds like a bug to me. Refcounting differences can cause crashes and memory leaks.
I'm sure there are no memory leaks.
I don't thik it Wine's bug. Applications don't depend on this stuff and Wine's ref handling is correct.
I'd be very surprised if there were no apps that depended on it, actually. Given the number of crashes we've seen caused by refcount problems in this part of the code, I'd say there definitely are.
Application that depend on this will look like:
pITypeInfo = ITypeLib_GetTypeLib(.....)
(some stuff) //here application doesn't release ITypeLib
if(ITypeInfo_Release(pTypeInfo) == 0) { /* something funny */ }
Applications shouldn't do that. If we want to be full compatibile, ITypeInfo has to be created while application asks about ITypeInfo for the first time. It's not a big problem to do so but I don't think it's really important. Another solution would be to destroy ITypeinfo when ref == -1 and make initial value 0. It will keep the present handling of ITypeInfo in ITypeLib and, for application, it will look like Windows ref handling, but I don't know if it is acceptable. I also think that the way Wine does it is better - it just works faster and needes less memory.
Jacek