d3dvideosink: Remove scary "while (object.refcount > 0) release (object);" code
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 22 Dec 2012 17:43:37 +0000 (18:43 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 22 Dec 2012 17:43:37 +0000 (18:43 +0100)
If there is a memory leak, this isn't the way how it should be fixed.

sys/d3dvideosink/d3dhelpers.c

index 2a9fc27..7f053a6 100644 (file)
@@ -924,16 +924,12 @@ d3d_release_swap_chain (GstD3DVideoSink * sink)
 
   if (sink->d3d.surface) {
     ref_count = IDirect3DSurface9_Release (sink->d3d.surface);
-    if (ref_count > 0)
-      while (IDirect3DSurface9_Release (sink->d3d.surface) > 0);
     sink->d3d.surface = NULL;
     GST_DEBUG_OBJECT (sink, "D3D surface released. Ref count: %d", ref_count);
   }
 
   if (sink->d3d.swapchain) {
     ref_count = IDirect3DSwapChain9_Release (sink->d3d.swapchain);
-    if (ref_count > 0)
-      while (IDirect3DSwapChain9_Release (sink->d3d.swapchain) > 0);
     sink->d3d.swapchain = NULL;
     GST_DEBUG_OBJECT (sink, "D3D swapchain released. Ref count: %d", ref_count);
   }
@@ -1019,8 +1015,6 @@ d3d_resize_swap_chain (GstD3DVideoSink * sink)
   /* Release current swapchain */
   if (sink->d3d.swapchain != NULL) {
     ref_count = IDirect3DSwapChain9_Release (sink->d3d.swapchain);
-    if (ref_count > 0)
-      while (IDirect3DSwapChain9_Release (sink->d3d.swapchain) > 0);
     if (ref_count > 0) {
       GST_WARNING_OBJECT (sink, "Release swapchain refcount: %d", ref_count);
     }