Maarten Lankhorst : quartz: Make the memory allocator emit more warnings and fix race condition.

Alexandre Julliard julliard at winehq.org
Wed Jun 25 04:47:10 CDT 2008


Module: wine
Branch: master
Commit: 8bedda7e1f3a9c8300b40d1473a4b43f577f527e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8bedda7e1f3a9c8300b40d1473a4b43f577f527e

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Mon Jun 23 12:08:10 2008 -0700

quartz: Make the memory allocator emit more warnings and fix race condition.

---

 dlls/quartz/memallocator.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index 7969193..2ee8d71 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -289,7 +289,10 @@ static HRESULT WINAPI BaseMemAllocator_GetBuffer(IMemAllocator * iface, IMediaSa
 
     EnterCriticalSection(This->pCritSect);
     if (!This->bCommitted || This->bDecommitQueued)
+    {
+        WARN("Not committed\n");
         hr = VFW_E_NOT_COMMITTED;
+    }
     else
         ++This->lWaiting;
     LeaveCriticalSection(This->pCritSect);
@@ -298,7 +301,10 @@ static HRESULT WINAPI BaseMemAllocator_GetBuffer(IMemAllocator * iface, IMediaSa
 
     if (WaitForSingleObject(This->hSemWaiting, (dwFlags & AM_GBF_NOWAIT) ? 0 : INFINITE) != WAIT_OBJECT_0)
     {
-        InterlockedDecrement(&This->lWaiting);
+        EnterCriticalSection(This->pCritSect);
+        --This->lWaiting;
+        LeaveCriticalSection(This->pCritSect);
+        WARN("Timed out\n");
         return VFW_E_TIMEOUT;
     }
 
@@ -324,6 +330,8 @@ static HRESULT WINAPI BaseMemAllocator_GetBuffer(IMemAllocator * iface, IMediaSa
     }
     LeaveCriticalSection(This->pCritSect);
 
+    if (hr != S_OK)
+        WARN("%08x\n", hr);
     return hr;
 }
 
@@ -614,7 +622,10 @@ static HRESULT WINAPI StdMediaSample2_SetActualDataLength(IMediaSample2 * iface,
     TRACE("(%d)\n", len);
 
     if ((len > This->props.cbBuffer) || (len < 0))
+    {
+        WARN("Tried to set length to %d, while max is %d\n", len, This->props.cbBuffer);
         return VFW_E_BUFFER_OVERFLOW;
+    }
     else
     {
         This->props.lActual = len;




More information about the wine-cvs mailing list