Raphael wrote:
- This->lock.DebugInfo->Spare[1] = 0;
- /*This->lock.DebugInfo->Spare[1] = 0;*/ DeleteCriticalSection(&(This->lock));
You have to zero this out or DeleteCriticalSection will try to delete that static memory.
How ? At opposite it produce DebugInfo leaks as seen in RtlDeleteCriticalSection (dlls/ntdll/critsection.c line 197)
<snip> if (crit->DebugInfo) { /* only free the ones we made in here */ if (!crit->DebugInfo->Spare[1]) { RtlFreeHeap( GetProcessHeap(), 0, crit->DebugInfo ); crit->DebugInfo = NULL; } }
Actually it will leak DebugInfo if DebugInfo->Spare[1] is not 0.
<snip> i will provide a WINE_DEBUG_UNSET_CS_NAME for this problem
...
+#define WINE_SET_CS_NAME(cs, name) (cs)->DebugInfo->Spare[1] = (DWORD) name +#define WINE_GET_CS_NAME(cs) (const char*) (cs)->lock.DebugInfo->Spare[1]
This is a wine specific trick and should probably be put somewhere global so all users can be consistent. The name should have DEBUG in it somewhere.
Yes, it should be better but i prefered to centralize it on dsound before moving it to wine/debug.h
Regards, Raphael
This is Alexandre's trick which I borrowed because it is very helpful in debugging lock problems. It would be nice to formalize this and make it available in a more general way but that is Alexandre's call.