On Sun Nov 2 17:39:19 2025 +0000, Piotr Caban wrote:
I've done some more tests looking into WinRT exception leaks. In the tests I have written we're leaking 2 references if builtin vccorlib140 and vcruntime140 is used. We're getting down to 1 reference being leaked when one of the dlls is native. There's no leak if both dlls are native. I think we need to understand it better before the change can get into wine.
It looks like on vccorlib140 side there's something along these lines:
```c static void DECLSPEC_NORETURN throw_exception(struct Exception *excp, const cxx_exception_type *type) { /* Thrown exceptions have a refcount of 2. */ __TRY { IInspectable_AddRef(&excp->IInspectable_iface); _CxxThrowException(&excp, type); } __FINALLY_CTX(throw_exception_finally, &excp->IInspectable_iface); } ```
I guess it tries to workaround some kind of refcounting error in older C-runtime/some kind of app. I'm not sure if it makes sense to replicate it as long as there's no application that depends on it. How about removing AddRef call from throw_exception helper?