From 0e043f4e5ab93f6639772f00b9767317e0c4e9f2 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Wed, 27 May 2020 15:10:33 -0700 Subject: [PATCH 1/4] Update wil. Fixes #5949 --- dep/wil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dep/wil b/dep/wil index e8c599bca6c..3c00e7f1d8c 160000 --- a/dep/wil +++ b/dep/wil @@ -1 +1 @@ -Subproject commit e8c599bca6c56c44b6730ad93f6abbc9ecd60fc1 +Subproject commit 3c00e7f1d8cf9930bbb8e5be3ef0df65c84e8928 From b8258b271197ddc980ce50f8d5b76c40cb21bf58 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Wed, 27 May 2020 15:17:18 -0700 Subject: [PATCH 2/4] Add IStorage to api list. --- .github/actions/spell-check/dictionary/api.txt | 0 .github/actions/spell-check/dictionary/apis.txt | 1 + 2 files changed, 1 insertion(+) create mode 100644 .github/actions/spell-check/dictionary/api.txt diff --git a/.github/actions/spell-check/dictionary/api.txt b/.github/actions/spell-check/dictionary/api.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/.github/actions/spell-check/dictionary/apis.txt b/.github/actions/spell-check/dictionary/apis.txt index 31381336e89..eda5856cefc 100644 --- a/.github/actions/spell-check/dictionary/apis.txt +++ b/.github/actions/spell-check/dictionary/apis.txt @@ -5,6 +5,7 @@ IBox ICustom IMap IObject +IStorage LCID NCHITTEST NCLBUTTONDBLCLK From 970fd67fd214c68e874b3f2c1b5766ea8da8862f Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Wed, 27 May 2020 15:35:42 -0700 Subject: [PATCH 3/4] Add try/catches around places with noexcept conflicts thanks to updated wil. --- src/buffer/out/CharRow.cpp | 2 +- src/buffer/out/CharRow.hpp | 2 +- src/cascadia/PublicTerminalCore/HwndTerminal.cpp | 4 ++++ src/cascadia/TerminalConnection/ConptyConnection.cpp | 4 ++++ src/renderer/dx/DxRenderer.cpp | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/buffer/out/CharRow.cpp b/src/buffer/out/CharRow.cpp index 07a66bb92f9..cf3bed4d810 100644 --- a/src/buffer/out/CharRow.cpp +++ b/src/buffer/out/CharRow.cpp @@ -321,7 +321,7 @@ COORD CharRow::GetStorageKey(const size_t column) const noexcept // - Updates the pointer to the parent row (which might change if we shuffle the rows around) // Arguments: // - pParent - Pointer to the parent row -void CharRow::UpdateParent(ROW* const pParent) noexcept +void CharRow::UpdateParent(ROW* const pParent) { _pParent = FAIL_FAST_IF_NULL(pParent); } diff --git a/src/buffer/out/CharRow.hpp b/src/buffer/out/CharRow.hpp index c0f8f19e8e2..f3ccd3dc55e 100644 --- a/src/buffer/out/CharRow.hpp +++ b/src/buffer/out/CharRow.hpp @@ -88,7 +88,7 @@ class CharRow final const UnicodeStorage& GetUnicodeStorage() const noexcept; COORD GetStorageKey(const size_t column) const noexcept; - void UpdateParent(ROW* const pParent) noexcept; + void UpdateParent(ROW* const pParent); friend CharRowCellReference; friend constexpr bool operator==(const CharRow& a, const CharRow& b) noexcept; diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index 79bebbe1705..41af69ebe82 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -29,6 +29,7 @@ LRESULT CALLBACK HwndTerminal::HwndTerminalWndProc( UINT uMsg, WPARAM wParam, LPARAM lParam) noexcept +try { #pragma warning(suppress : 26490) // Win32 APIs can only store void*, have to use reinterpret_cast HwndTerminal* terminal = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); @@ -84,6 +85,7 @@ LRESULT CALLBACK HwndTerminal::HwndTerminalWndProc( } return DefWindowProc(hwnd, uMsg, wParam, lParam); } +CATCH_LOG() static bool RegisterTermClass(HINSTANCE hInstance) noexcept { @@ -686,6 +688,7 @@ void __stdcall TerminalKillFocus(void* terminal) // - rows - Rows of text data to copy // - fAlsoCopyFormatting - true if the color and formatting should also be copied, false otherwise HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, bool const fAlsoCopyFormatting) +try { std::wstring finalString; @@ -742,6 +745,7 @@ HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& return S_OK; } +CATCH_RETURN() // Routine Description: // - Copies the given string onto the global system clipboard in the specified format diff --git a/src/cascadia/TerminalConnection/ConptyConnection.cpp b/src/cascadia/TerminalConnection/ConptyConnection.cpp index b0a0482c01f..4734b4835a1 100644 --- a/src/cascadia/TerminalConnection/ConptyConnection.cpp +++ b/src/cascadia/TerminalConnection/ConptyConnection.cpp @@ -294,6 +294,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation // Method Description: // - called when the client application (not necessarily its pty) exits for any reason void ConptyConnection::_ClientTerminated() noexcept + try { if (_isStateAtOrBeyond(ConnectionState::Closing)) { @@ -321,6 +322,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation _piClient.reset(); } + CATCH_LOG() void ConptyConnection::WriteInput(hstring const& data) { @@ -349,6 +351,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation } void ConptyConnection::Close() noexcept + try { if (_transitionToState(ConnectionState::Closing)) { @@ -378,6 +381,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation _transitionToState(ConnectionState::Closed); } } + CATCH_LOG() DWORD ConptyConnection::_OutputThread() { diff --git a/src/renderer/dx/DxRenderer.cpp b/src/renderer/dx/DxRenderer.cpp index b61f1e090a5..a36c1856222 100644 --- a/src/renderer/dx/DxRenderer.cpp +++ b/src/renderer/dx/DxRenderer.cpp @@ -2236,6 +2236,7 @@ void DxEngine::SetAntialiasingMode(const D2D1_TEXT_ANTIALIAS_MODE antialiasingMo // Return Value: // - void DxEngine::SetDefaultTextBackgroundOpacity(const float opacity) noexcept +try { _defaultTextBackgroundOpacity = opacity; @@ -2244,3 +2245,4 @@ void DxEngine::SetDefaultTextBackgroundOpacity(const float opacity) noexcept // We don't terribly care if this fails. LOG_IF_FAILED(InvalidateAll()); } +CATCH_LOG() From b59d8a819f80104fc4a08c0685bbe1c42d5267f6 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 1 Jun 2020 15:10:43 -0700 Subject: [PATCH 4/4] drop extra noexcept --- src/cascadia/PublicTerminalCore/HwndTerminal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index 41af69ebe82..7dcc5c3976c 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -717,7 +717,7 @@ try RETURN_LAST_ERROR_IF(!OpenClipboard(_hwnd.get())); { // Clipboard Scope - auto clipboardCloser = wil::scope_exit([]() noexcept { + auto clipboardCloser = wil::scope_exit([]() { LOG_LAST_ERROR_IF(!CloseClipboard()); });