From 80ebe871c7af413e5f3adced95e84ec238a884a2 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Thu, 14 Apr 2022 23:10:39 -0700 Subject: [PATCH] Coordinated fix for capturing continuation context for tasks in Desktop apps (#2654) Co-authored-by: Stephan T. Lavavej --- stl/CMakeLists.txt | 2 +- stl/msbuild/stl_base/msvcp.settings.targets | 2 ++ stl/src/ppltasks.cpp | 25 ++------------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index fae0ffdb05..bfd402fb5a 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -458,7 +458,7 @@ function(add_stl_dlls D_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIO target_compile_options(msvcp${D_SUFFIX}_eha_objects PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};${GL_FLAG};/EHa") add_library(msvcp${D_SUFFIX} SHARED) - target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib") + target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "ole32.lib") set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_base${D_SUFFIX}${VCLIBS_SUFFIX}") set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set_target_properties(msvcp${D_SUFFIX} PROPERTIES OUTPUT_NAME "msvcp140${D_SUFFIX}${VCLIBS_SUFFIX}") diff --git a/stl/msbuild/stl_base/msvcp.settings.targets b/stl/msbuild/stl_base/msvcp.settings.targets index 3dec66549c..c48c557039 100644 --- a/stl/msbuild/stl_base/msvcp.settings.targets +++ b/stl/msbuild/stl_base/msvcp.settings.targets @@ -50,6 +50,8 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -opt:ref,noicf $(LinkAdditionalOptions) -nodefaultlib:libcpmt$(BuildSuffix).lib $(LinkAdditionalOptions) -nodefaultlib:$(LibOutputFile) $(LinkAdditionalOptions) + true + ole32.lib $(LinkAdditionalOptions) true true diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index 58951d834c..c8b66affd5 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -7,7 +7,6 @@ #include -#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT) #ifndef UNDOCKED_WINDOWS_UCRT #pragma warning(push) #pragma warning(disable : 4265) // non-virtual destructor in base class @@ -19,7 +18,8 @@ #include #include #include -#endif + +#pragma comment(lib, "ole32") // This IID is exported by ole32.dll; we cannot depend on ole32.dll on OneCore. static GUID const Local_IID_ICallbackWithNoReentrancyToApplicationSTA = { @@ -217,7 +217,6 @@ namespace Concurrency { _CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() {} #endif -#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT) using namespace ABI::Windows::Foundation; using namespace ABI::Windows::Foundation::Diagnostics; using namespace Microsoft::WRL; @@ -317,26 +316,6 @@ namespace Concurrency { } return false; } - -#else - _CRTIMP2 void __thiscall _ContextCallback::_CallInContext(_CallbackFunction _Func, bool) const { - _Func(); - } - - _CRTIMP2 void __thiscall _ContextCallback::_Capture() {} - - _CRTIMP2 void __thiscall _ContextCallback::_Reset() {} - - _CRTIMP2 void __thiscall _ContextCallback::_Assign(void*) {} - - _CRTIMP2 bool __cdecl _ContextCallback::_IsCurrentOriginSTA() { - return false; - } - - _CRTIMP2 bool __cdecl _Task_impl_base::_IsNonBlockingThread() { - return false; - } -#endif } // namespace details #ifdef _CRT_APP