From: Vibhav Pant vibhavp@gmail.com
--- dlls/msvcrt/cppexcept.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h index 0f64f97dd20..9abdcc0569b 100644 --- a/dlls/msvcrt/cppexcept.h +++ b/dlls/msvcrt/cppexcept.h @@ -261,8 +261,10 @@ static inline void copy_exception( void *object, void **dest, UINT catch_flags, } else if (type->flags & CLASS_IS_SIMPLE_TYPE) { + /* WinRT exceptions are thrown with a reference count of 2, the refcount is decreased before it's handed off to a + * matching catch block. */ if (type->flags & CLASS_IS_WINRT && *(IUnknown**)object) - IUnknown_AddRef(*(IUnknown**)object); + IUnknown_Release(*(IUnknown**)object); memmove( dest, object, type->size ); /* if it is a pointer, adjust it */ if (type->size == sizeof(void*)) *dest = get_this_pointer( &type->offsets, *dest ); @@ -278,7 +280,7 @@ static inline void copy_exception( void *object, void **dest, UINT catch_flags, else { if (type->flags & CLASS_IS_WINRT && *(IUnknown**)object) - IUnknown_AddRef(*(IUnknown**)object); + IUnknown_Release(*(IUnknown**)object); memmove( dest, get_this_pointer( &type->offsets, object ), type->size ); } }