Enable winrt::make<> detection (#10264)

C++/WinRT has a way to ensure that we use `make<>` instead of allocating
WinRT objects on the stack, but until 10.0.19041 the XAML compiler
generated code that violated that rule.

Because of how make detection is implemented, it must create a derived
type (and so WinRT implementation types can't be `final`).
This commit is contained in:
Dustin L. Howett 2021-06-01 17:33:53 -05:00 committed by GitHub
parent f3ca1ed136
commit e3281ce354
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 9 deletions

View file

@ -28,7 +28,7 @@ Abstract:
namespace winrt::Microsoft::Terminal::Remoting::implementation
{
struct WindowManager final : public WindowManagerT<WindowManager>
struct WindowManager : public WindowManagerT<WindowManager>
{
WindowManager();
~WindowManager();

View file

@ -63,10 +63,6 @@
<!-- Manually disable unreachable code warning, because jconcpp has a ton of that. -->
<DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<!-- Many of our projects use XAML, which cannot handle make detection.
We cannot link static libs with differing values of WINRT_NO_MAKE_DETECTION, so let's force it for everyone. -->
<PreprocessorDefinitions>WINRT_NO_MAKE_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>

View file

@ -11,6 +11,7 @@
<Import Project="$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.210309.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.210309.3\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTHeapEnforcement>AnyValueHereWillDisableTheOptOut</CppWinRTHeapEnforcement>
<CppWinRTEnabled>true</CppWinRTEnabled>
<CppWinRTOptimized>true</CppWinRTOptimized>
<DefaultLanguage>en-US</DefaultLanguage>
@ -75,10 +76,6 @@
<DisableSpecificWarnings>28204;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<!-- Many of our projects use XAML, which cannot handle make detection.
We cannot link static libs with differing values of WINRT_NO_MAKE_DETECTION, so let's force it for everyone. -->
<PreprocessorDefinitions>WINRT_NO_MAKE_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem Condition="'%(SubSystem)'==''">Console</SubSystem>