wshom.ocx: Properly update typeinfo refcount

Nikolay Sivov nsivov at codeweavers.com
Wed Nov 28 10:08:53 CST 2012


On 11/28/2012 17:43, Alexandre Julliard wrote:
> Nikolay Sivov <nsivov at codeweavers.com> writes:
>
>> @@ -137,8 +137,13 @@ static HRESULT WINAPI WshCollection_GetTypeInfoCount(IWshCollection *iface, UINT
>>   static HRESULT WINAPI WshCollection_GetTypeInfo(IWshCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
>>   {
>>       WshCollection *This = impl_from_IWshCollection(iface);
>> +    HRESULT hr;
>> +
>>       TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
>> -    return get_typeinfo(IWshCollection_tid, ppTInfo);
>> +
>> +    hr = get_typeinfo(IWshCollection_tid, ppTInfo);
>> +    ITypeInfo_AddRef(*ppTInfo);
>> +    return hr;
> You'd need to check for error first, but the AddRef should really be in
> get_typeinfo().
I agree about error part. The reason why AddRef shouldn't be in 
get_typeinfo() is to avoid pointless AddRef/Release when pointer does 
not go out, and the only case when it's returned to caller is this 
GetTypeInfo() method.




More information about the wine-devel mailing list