http://bugs.winehq.org/show_bug.cgi?id=4436
------- Additional Comments From J.A.Gow@furrybubble.co.uk 2006-09-02 04:58 ------- Thanks for the comments Mike. However I first must stress that the Commit is _not_ the source of the trouble. The app uses a storage file that is shipped with the app, i.e. it does not create it. I do have to create one during the performance tests in order to have something to test with and I do the Commit just to be sure that all streams are correctly written to the file (I don't know if it is strictly necessary, as I said I am not a Windows apps programmer!)
The problem is almost certainly somewhere in the reference counting. Yes, my patch _does_ work on Windows (tested on XP - I can't test other versions of Win), and _does_ fail on Wine CVS. I described the methodology behind my Releases in the comments earlier in the bug report.
I completely agree with you that it is technically wrong to have to Release twice. However, under Wine I _must_ to do this or the storage file is not closed! This is the actual problem! Under Windows, I only have to Release once, as would be expected. So that is the reason I had two Releases in the performance test, the second enclosed in a return code test.
Under Wine, the first Release returns 1, but does not close the storagefile. The second Release returns zero and closes the file. If I do not execute the second Release under Wine, the file remains open and cannot be reopened in subsequent tests.
Under WinXP, the first release returns zero, and closes the storage file. The second Release is then not executed. This stops the conformance test from crashing under Windows, as the first Release frees the 'stg' object.
I looked at your patch modification, and this will segfault under Win (I know, this is how I did it initially!) as after the first Release, the 'stg' object is freed. The second Release is called on unallocated memory, and the conformance test crashes. It will, however, not segfault under Wine because under Wine, the first Release does _not_ free the 'stg' object. The way I did it highlights the problem without the conformance test crashing under Win.
I have submitted the original patch to wine-patches, however I forgot the todo_wine { } sections, so I may have to resubmit it.