[PATCH 2/3] winecoreaudio: Ignore failure to notify winmm wave clients (w/ patch)

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Mon Mar 14 05:11:59 CDT 2011


All 3 drivers leaked resources when given bad callback flags.
It was wrong to fully initialize the device, then finally do
-    ret = wodNotifyClient(wwo, WOM_OPEN, 0L, 0L);
     return ret;
and perhaps return an error, causing winmm not to see the open'ed device  => leak.

Two solution paths:
A either use if (err) goto errcleanup;
B ignore the notification error (check for it earlier).

I choose B because
 - Native ignores some combinations of callback flags that don't make sense (testbot job 9779), therefore the ability to notify is not a condition for successful opening.
 - DriverCallback does not perform interesting error tests that could not be detected in advance by looking at the flags.
 - The different MMSYSERR_ values that the winmm returns for particular sets of bad flags (bug #16544 among others) cannot be derived from DriverCallback's binary TRUE/FALSE result.

The MCI performs a similar check and returns MCIERR_NO_WINDOW from "window a handle 1"

Hence this set of driver patches should be complemented by one winmm patch which I've not yet written:
Mixer/aux/mod/wodopen () {
  /* first check cb flags
  dwRet = verifyCallback(cbinstance, dwFlags)
  If (dwRet) return dwRet or goto errorcleanup;
  /* then only perform other checks
static verifyCallback
  { return MMSYSERR_INVALPARAM etc. }

BTW, according to MSDN, DriverCallback should return false when the task's queue is full.  Wine ignores PostThreadMessage's return value.

 Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-winecoreaudio-Ignore-failure-to-notify-winmm-wave-cl.patch
Type: application/octet-stream
Size: 4291 bytes
Desc: 0002-winecoreaudio-Ignore-failure-to-notify-winmm-wave-cl.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20110314/6fe972ff/attachment.obj>

More information about the wine-patches mailing list