d3dvideosink: Remove scary "while (object.refcount > 0) release (object);" code

If there is a memory leak, this isn't the way how it should be fixed.
This commit is contained in:
Sebastian Dröge 2012-12-22 18:43:37 +01:00
parent 038cf9eba0
commit 85690b802d

View file

@ -924,16 +924,12 @@ d3d_release_swap_chain (GstD3DVideoSink * sink)
if (sink->d3d.surface) { if (sink->d3d.surface) {
ref_count = IDirect3DSurface9_Release (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; sink->d3d.surface = NULL;
GST_DEBUG_OBJECT (sink, "D3D surface released. Ref count: %d", ref_count); GST_DEBUG_OBJECT (sink, "D3D surface released. Ref count: %d", ref_count);
} }
if (sink->d3d.swapchain) { if (sink->d3d.swapchain) {
ref_count = IDirect3DSwapChain9_Release (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; sink->d3d.swapchain = NULL;
GST_DEBUG_OBJECT (sink, "D3D swapchain released. Ref count: %d", ref_count); 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 */ /* Release current swapchain */
if (sink->d3d.swapchain != NULL) { if (sink->d3d.swapchain != NULL) {
ref_count = IDirect3DSwapChain9_Release (sink->d3d.swapchain); ref_count = IDirect3DSwapChain9_Release (sink->d3d.swapchain);
if (ref_count > 0)
while (IDirect3DSwapChain9_Release (sink->d3d.swapchain) > 0);
if (ref_count > 0) { if (ref_count > 0) {
GST_WARNING_OBJECT (sink, "Release swapchain refcount: %d", ref_count); GST_WARNING_OBJECT (sink, "Release swapchain refcount: %d", ref_count);
} }