Commit 663af65e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Fix EndCreateObject*() when events are used.

parent d762d863
...@@ -4259,6 +4259,7 @@ struct resolver_queued_result ...@@ -4259,6 +4259,7 @@ struct resolver_queued_result
IUnknown *object; IUnknown *object;
MF_OBJECT_TYPE obj_type; MF_OBJECT_TYPE obj_type;
HRESULT hr; HRESULT hr;
IMFAsyncResult *inner_result;
enum resolved_object_origin origin; enum resolved_object_origin origin;
}; };
...@@ -4313,7 +4314,7 @@ static HRESULT resolver_handler_end_create(struct source_resolver *resolver, enu ...@@ -4313,7 +4314,7 @@ static HRESULT resolver_handler_end_create(struct source_resolver *resolver, enu
IMFSchemeHandler *scheme_handler; IMFSchemeHandler *scheme_handler;
} handler; } handler;
queued_result = heap_alloc(sizeof(*queued_result)); queued_result = heap_alloc_zero(sizeof(*queued_result));
IMFAsyncResult_GetObject(inner_result, &handler.handler); IMFAsyncResult_GetObject(inner_result, &handler.handler);
...@@ -4337,6 +4338,12 @@ static HRESULT resolver_handler_end_create(struct source_resolver *resolver, enu ...@@ -4337,6 +4338,12 @@ static HRESULT resolver_handler_end_create(struct source_resolver *resolver, enu
{ {
MFASYNCRESULT *data = (MFASYNCRESULT *)inner_result; MFASYNCRESULT *data = (MFASYNCRESULT *)inner_result;
if (data->hEvent)
{
queued_result->inner_result = inner_result;
IMFAsyncResult_AddRef(queued_result->inner_result);
}
/* Push resolved object type and created object, so we don't have to guess on End*() call. */ /* Push resolved object type and created object, so we don't have to guess on End*() call. */
EnterCriticalSection(&resolver->cs); EnterCriticalSection(&resolver->cs);
list_add_tail(&resolver->pending, &queued_result->entry); list_add_tail(&resolver->pending, &queued_result->entry);
...@@ -4687,7 +4694,7 @@ static HRESULT resolver_end_create_object(struct source_resolver *resolver, enum ...@@ -4687,7 +4694,7 @@ static HRESULT resolver_end_create_object(struct source_resolver *resolver, enum
LIST_FOR_EACH_ENTRY(iter, &resolver->pending, struct resolver_queued_result, entry) LIST_FOR_EACH_ENTRY(iter, &resolver->pending, struct resolver_queued_result, entry)
{ {
if (iter->object == object && iter->origin == origin) if (iter->inner_result == result || (iter->object == object && iter->origin == origin))
{ {
list_remove(&iter->entry); list_remove(&iter->entry);
queued_result = iter; queued_result = iter;
...@@ -4704,6 +4711,8 @@ static HRESULT resolver_end_create_object(struct source_resolver *resolver, enum ...@@ -4704,6 +4711,8 @@ static HRESULT resolver_end_create_object(struct source_resolver *resolver, enum
*out = queued_result->object; *out = queued_result->object;
*obj_type = queued_result->obj_type; *obj_type = queued_result->obj_type;
hr = queued_result->hr; hr = queued_result->hr;
if (queued_result->inner_result)
IMFAsyncResult_Release(queued_result->inner_result);
heap_free(queued_result); heap_free(queued_result);
} }
else else
......
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