oleaut32: fix tests for redundant headers in OLEPicture load from IStream

a_villacis at palosanto.com a_villacis at palosanto.com
Sat Dec 23 21:02:33 CST 2006


A few days ago, I was notified that the olepicture tests were failing with
a crash in all versions of Windows. Today I checked this and it turns out
to be true. The following patch fixes this.

The long reason involves two bugs. The first one is that the
NoStatStreamImpl_Construct function in the olepicture test builds a COM
object with a reference count of 0, not 1. Apparently the native code does
an AddRef and then a Release on this object, which starts at 0, then 1,
then 0 (triggering destruction), *before* the IStream_Release issued by
the test code. Just replacing the 0 with an 1 fixes this. However this fix
reveals an even bigger bug, which stems from a misunderstanding of mine
about the intended ownership of a memory handle. The non-statable
implementation of IStream used in the test *always* GlobalFree's the
passed memory handle, so the reuse of a (freed) memory handle in the
redundant header loop is incorrect and leads to intermitent crashes in
Win98, and test failures in Wine and WinXP. So now the loop allocates and
initializes the memory anew on each iteration. The test now passes in
Win98 and WinXP as well as in Wine.

Changelog:
* Fix incorrect memory usage and incorrect refcounting in non-statable
IStream in olepicture load test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-oleaut32-olepicture-multiple_lt-fix.patch
Type: text/x-patch
Size: 3421 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20061223/321247fe/wine-oleaut32-olepicture-multiple_lt-fix.bin


More information about the wine-patches mailing list