Michael,

>+#include <assert.h>

your patch is already committed, yet I believe that the least that dsound needs 
is new asserts.

Asserts in dsound have been a PITA in Wine for the last decade.

It's ok for the kernel to crash in an assert. IMHO it is not ok for an optional 
thing like sound.

The assert's backtrace will not help anybody, because the logical error will 
have happened much earlier.

Instead, a plain ERR would have been just as telling. Let's quote
http://www.winehq.org/docs/winedev-guide/debugging#DBG-CLASSES
"ERR: Messages in this class indicate serious errors in Wine,
          such as as conditions that should never happen by design."

I recommend:
-    assert(device->buffers[0] == pDSB);
+   if (pdevice->buffers[0] != pDSB)
+       ERR("broken device buffer %p\n", device->buffers[0]);
      HeapFree(GetProcessHeap(), 0, device->buffers);
      device->buffers = NULL;

The ERR is IMHO revealing enough in a user's log.

If a sound component detects a bogus state,
I'd very much prefer that it disables sound -- without crashing.

Regards,
 Jörg Höhle

Reply via email to