quartz: Avoid asserting from used samples on allocator release

Chris Robinson chris.kcat at gmail.com
Tue Mar 13 12:59:03 CDT 2007


-------------- next part --------------
From 74de55cc015fcf293187ef487e066aafefcfc610 Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat at gmail.com>
Date: Tue, 13 Mar 2007 10:26:48 -0700
Subject: [PATCH] quartz: Avoid asserting from used samples on allocator release

---
 dlls/quartz/memallocator.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index d36b83c..9167990 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -490,7 +490,10 @@ static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
 
     if (!ref)
     {
-        IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
+        if (This->pParent)
+            IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
+        else
+            StdMediaSample2_Delete(This);
         return 0;
     }
     return ref;
@@ -813,7 +816,17 @@ static HRESULT StdMemAllocator_Free(IMemAllocator * iface)
     StdMemAllocator *This = (StdMemAllocator *)iface;
     struct list * cursor;
 
-    assert(list_empty(&This->base.used_list));
+    if (!list_empty(&This->base.used_list))
+    {
+        WARN("Freeing allocator with outstanding samples!\n");
+        while ((cursor = list_head(&This->base.used_list)) != NULL)
+        {
+            StdMediaSample2 *pSample;
+            list_remove(cursor);
+            pSample = LIST_ENTRY(cursor, StdMediaSample2, listentry);
+            pSample->pParent = NULL;
+        }
+    }
 
     while ((cursor = list_head(&This->base.free_list)) != NULL)
     {
-- 
1.4.4.4



More information about the wine-patches mailing list