Module: wine Branch: master Commit: a261c043ebc74d39462a31a0dfcacf055f4b6c4c URL: https://gitlab.winehq.org/wine/wine/-/commit/a261c043ebc74d39462a31a0dfcacf0...
Author: Torge Matthies tmatthies@codeweavers.com Date: Mon Sep 26 23:04:01 2022 +0200
msvcr120: Throw exception in ~_StructuredTaskCollection if _RunAndWait was not called.
---
dlls/msvcrt/concurrency.c | 11 +++++++++++ dlls/msvcrt/cxx.h | 2 ++ 2 files changed, 13 insertions(+)
diff --git a/dlls/msvcrt/concurrency.c b/dlls/msvcrt/concurrency.c index 6d7e9f18d63..fe156938e3a 100644 --- a/dlls/msvcrt/concurrency.c +++ b/dlls/msvcrt/concurrency.c @@ -686,6 +686,9 @@ DEFINE_CXX_DATA1(invalid_multiple_scheduling, &cexception_cxx_type_info, cexcept DEFINE_CXX_DATA1(invalid_scheduler_policy_key, &cexception_cxx_type_info, cexception_dtor) DEFINE_CXX_DATA1(invalid_scheduler_policy_thread_specification, &cexception_cxx_type_info, cexception_dtor) DEFINE_CXX_DATA1(invalid_scheduler_policy_value, &cexception_cxx_type_info, cexception_dtor) +#if _MSVCR_VER >= 120 +DEFINE_CXX_DATA1(missing_wait, &cexception_cxx_type_info, cexception_dtor) +#endif DEFINE_CXX_DATA1(scheduler_resource_allocation_error, &cexception_cxx_type_info, cexception_dtor)
__ASM_BLOCK_BEGIN(concurrency_exception_vtables) @@ -1930,6 +1933,11 @@ DEFINE_THISCALL_WRAPPER(_StructuredTaskCollection_dtor, 4) void __thiscall _StructuredTaskCollection_dtor(_StructuredTaskCollection *this) { FIXME("(%p): stub!\n", this); + if (this->count && !__uncaught_exception()) { + missing_wait e; + missing_wait_ctor_str(&e, "Missing call to _RunAndWait"); + _CxxThrowException(&e, &missing_wait_exception_type); + } }
#endif /* _MSVCR_VER >= 120 */ @@ -3445,6 +3453,9 @@ void msvcrt_init_concurrency(void *base) init_invalid_scheduler_policy_key_cxx(base); init_invalid_scheduler_policy_thread_specification_cxx(base); init_invalid_scheduler_policy_value_cxx(base); +#if _MSVCR_VER >= 120 + init_missing_wait_cxx(base); +#endif init_scheduler_resource_allocation_error_cxx(base); #endif } diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h index c2558974b73..aa73aabf797 100644 --- a/dlls/msvcrt/cxx.h +++ b/dlls/msvcrt/cxx.h @@ -321,3 +321,5 @@ void exception_ptr_from_record(exception_ptr*,EXCEPTION_RECORD*) DECLSPEC_HIDDEN void __cdecl __ExceptionPtrCreate(exception_ptr*); void __cdecl __ExceptionPtrDestroy(exception_ptr*); void __cdecl __ExceptionPtrRethrow(const exception_ptr*); + +BOOL __cdecl __uncaught_exception(void);