From dbee90a728a9c2a8bf3009f2a81c4b3d7f5b9eab Mon Sep 17 00:00:00 2001 From: Aaryaman Vasishta Date: Sun, 26 Apr 2015 16:49:01 +0530 Subject: [PATCH] d3drm: Move Release from frame2->frame3. --- dlls/d3drm/frame.c | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 22daec4474b..4f9d9529f77 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -485,32 +485,10 @@ static ULONG WINAPI d3drm_frame2_AddRef(IDirect3DRMFrame2 *iface) static ULONG WINAPI d3drm_frame2_Release(IDirect3DRMFrame2 *iface) { struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); - ULONG refcount = InterlockedDecrement(&frame->ref); - ULONG i; - TRACE("%p decreasing refcount to %u.\n", iface, refcount); + TRACE("iface %p.\n", iface); - if (!refcount) - { - for (i = 0; i < frame->nb_children; ++i) - { - IDirect3DRMFrame3_Release(frame->children[i]); - } - HeapFree(GetProcessHeap(), 0, frame->children); - for (i = 0; i < frame->nb_visuals; ++i) - { - IDirect3DRMVisual_Release(frame->visuals[i]); - } - HeapFree(GetProcessHeap(), 0, frame->visuals); - for (i = 0; i < frame->nb_lights; ++i) - { - IDirect3DRMLight_Release(frame->lights[i]); - } - HeapFree(GetProcessHeap(), 0, frame->lights); - HeapFree(GetProcessHeap(), 0, frame); - } - - return refcount; + return IDirect3DRMFrame3_Release(&frame->IDirect3DRMFrame3_iface); } static HRESULT WINAPI d3drm_frame2_Clone(IDirect3DRMFrame2 *iface, @@ -1248,10 +1226,32 @@ static ULONG WINAPI d3drm_frame3_AddRef(IDirect3DRMFrame3 *iface) static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface) { struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG refcount = InterlockedDecrement(&frame->ref); + ULONG i; - TRACE("iface %p.\n", iface); + TRACE("%p decreasing refcount to %u.\n", iface, refcount); - return d3drm_frame2_Release(&frame->IDirect3DRMFrame2_iface); + if (!refcount) + { + for (i = 0; i < frame->nb_children; ++i) + { + IDirect3DRMFrame3_Release(frame->children[i]); + } + HeapFree(GetProcessHeap(), 0, frame->children); + for (i = 0; i < frame->nb_visuals; ++i) + { + IDirect3DRMVisual_Release(frame->visuals[i]); + } + HeapFree(GetProcessHeap(), 0, frame->visuals); + for (i = 0; i < frame->nb_lights; ++i) + { + IDirect3DRMLight_Release(frame->lights[i]); + } + HeapFree(GetProcessHeap(), 0, frame->lights); + HeapFree(GetProcessHeap(), 0, frame); + } + + return refcount; } static HRESULT WINAPI d3drm_frame3_Clone(IDirect3DRMFrame3 *iface,