Commit c80d5c15 authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

amstream: Decrement "sample_refs" only when the object is being released.

parent 59c206f9
...@@ -980,7 +980,6 @@ HRESULT ddraw_stream_create(IUnknown *outer, void **out) ...@@ -980,7 +980,6 @@ HRESULT ddraw_stream_create(IUnknown *outer, void **out)
object->IMemInputPin_iface.lpVtbl = &ddraw_meminput_vtbl; object->IMemInputPin_iface.lpVtbl = &ddraw_meminput_vtbl;
object->IPin_iface.lpVtbl = &ddraw_sink_vtbl; object->IPin_iface.lpVtbl = &ddraw_sink_vtbl;
object->ref = 1; object->ref = 1;
object->sample_refs = 0;
InitializeCriticalSection(&object->cs); InitializeCriticalSection(&object->cs);
...@@ -1043,12 +1042,12 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface) ...@@ -1043,12 +1042,12 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface)
TRACE("(%p)->(): new ref = %u\n", iface, ref); TRACE("(%p)->(): new ref = %u\n", iface, ref);
EnterCriticalSection(&sample->parent->cs);
InterlockedDecrement(&sample->parent->sample_refs);
LeaveCriticalSection(&sample->parent->cs);
if (!ref) if (!ref)
{ {
EnterCriticalSection(&sample->parent->cs);
--sample->parent->sample_refs;
LeaveCriticalSection(&sample->parent->cs);
if (sample->surface) if (sample->surface)
IDirectDrawSurface_Release(sample->surface); IDirectDrawSurface_Release(sample->surface);
HeapFree(GetProcessHeap(), 0, sample); HeapFree(GetProcessHeap(), 0, sample);
...@@ -1166,7 +1165,7 @@ static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDraw ...@@ -1166,7 +1165,7 @@ static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDraw
object->parent = parent; object->parent = parent;
EnterCriticalSection(&parent->cs); EnterCriticalSection(&parent->cs);
InterlockedIncrement(&parent->sample_refs); ++parent->sample_refs;
LeaveCriticalSection(&parent->cs); LeaveCriticalSection(&parent->cs);
if (surface) if (surface)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment