On 10/9/06, Michal Okresa michal.okresa@ifne.eu wrote:
On Monday 09 October 2006 19:14, Dan Kegel wrote: ...
I think it's great you're working on this. What were the bugs?
Thanks for your comments.
I discovered these two problems in Rob's patch which make test crash.
- Firstly function IKindaEnumWidget_Release(pKEW) was called twice in test
sequence:
IKindaEnumWidget_Release(pKEW); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL); hr = CoUnmarshalInterface(pStream, &IID_IKindaEnumWidget, (void **)&pKEW); ok_ole_success(hr, CoUnmarshalInterface); IStream_Release(pStream);
hr = IKindaEnumWidget_Next(pKEW, &pWidget); /* pKEW !!! */ ok_ole_success(hr, IKindaEnumWidget_Next);
IKindaEnumWidget_Release(pKEW);
As you can see, pKEW is used even though memory was released.
- Second problem was in function: static IWidget *Widget_Create(void).
ITypeLib_GetTypeInfoOfGuid failed with wine (but only in last test - test_DispCallFunc) and hr pointer is NULL. Therefore ITypeLib_Release(pTypeInfo) after IF {} block might not be called.
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IWidget, &pTypeInfo); ok_ole_success(hr, ITypeLib_GetTypeInfoOfGuid); if (SUCCEEDED(hr)) { This->pDispatchUnknown = NULL; hr = CreateStdDispatch((IUnknown *)&This->lpVtbl, This, pTypeInfo, &This->pDispatchUnknown); ok_ole_success(hr, CreateStdDispatch); ITypeInfo_Release(pTypeInfo); } ITypeLib_Release(pTypeInfo); (hr is null)
This problem was difficult to find because test crashed randomly (winedbg excercise ;-) )
And finally I added few VariantClear() calls (but this isn't important)
Thanks for the info...
Dan H., could you have a quick look at Michal's patch? - Dan
On Mon, Oct 09, 2006 at 03:45:16PM -0700, Dan Kegel wrote:
Dan H., could you have a quick look at Michal's patch?
Well, the patch I sent in didn't crash on my machine, but crashed on Alexandre's (and maybe others' who didn't try to run it). It's pretty hard to fix something that works when you run it, so I never did track down the problem. Probably Rob, I know he's busy, is more qualified to comment on differences between this and what I sent in. The patch should probably add the test to the Makefile. (BTW, I don't think the Makefile patch I sent in will work anymore since Alexandre made various changes to the rules files.)
One thing I'd note is that the test ran flawlessly on Windows when I tried it, so I have no reason to believe there's anything wrong with the test itself. The bugs are either in Wine or WIDL. I don't remember if I ran the test on Windows with a WIDL- or MIDL- generated typelib, but if it runs fine on Windows with a WIDL-generated typelib, I'd look for bugs in Wine. Otherwise, I'd look for bugs in WIDL. I think the test is OK.