static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface) { IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); if (ref == 0) { wined3d_mutex_lock(); wined3d_stateblock_decref(This->wined3d_stateblock); wined3d_mutex_unlock(); IDirect3DDevice9Ex_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref; }
static ULONG WINAPI d3d9_stateblock_Release(IDirect3DStateBlock9 *iface) { struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface); ULONG refcount = InterlockedDecrement(&stateblock->refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) { wined3d_mutex_lock(); wined3d_stateblock_decref(stateblock->wined3d_stateblock); wined3d_mutex_unlock(); IDirect3DDevice9Ex_Release(stateblock->parent_device); HeapFree(GetProcessHeap(), 0, stateblock); } return refcount; }