From: Vibhav Pant vibhavp@gmail.com
--- dlls/msvcp90/exception.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index aef1268068c..df2f52c0755 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -43,7 +43,7 @@ CREATE_TYPE_INFO_VTABLE
#define CLASS_IS_SIMPLE_TYPE 1 #define CLASS_HAS_VIRTUAL_BASE_CLASS 4 -#define CLASS_IS_IUNKNOWN 8 +#define CLASS_IS_WINRT 8
int* __cdecl __processing_throw(void);
@@ -1200,8 +1200,10 @@ static inline void copy_exception( void *object, void **dest, UINT catch_flags, { if (type->flags & CLASS_IS_SIMPLE_TYPE) { - if (type->flags & CLASS_IS_IUNKNOWN && *(IUnknown**)object) - IUnknown_AddRef(*(IUnknown**)object); + /* 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_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 ); @@ -1216,8 +1218,8 @@ static inline void copy_exception( void *object, void **dest, UINT catch_flags, } else { - if (type->flags & CLASS_IS_IUNKNOWN && *(IUnknown**)object) - IUnknown_AddRef(*(IUnknown**)object); + if (type->flags & CLASS_IS_WINRT && *(IUnknown**)object) + IUnknown_Release(*(IUnknown**)object); memmove( dest, get_this_pointer( &type->offsets, object ), type->size ); } }