From 8f7769468eb540eb5c8efa9543e086ad60267bab Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 10 Mar 2022 08:16:10 -0600 Subject: [PATCH] Fix showing a dialog multiple times (#12625) After the dialog is displayed, always clear it out. If we don't, we won't be able to display another! * regressed in #12517. * [x] Fixes #12622. (cherry picked from commit 2e78ebfdc7626509242475b710640b3ca2f6ca60) --- src/cascadia/TerminalApp/AppLogic.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/AppLogic.cpp b/src/cascadia/TerminalApp/AppLogic.cpp index 71698f7c4c2..0d8cb34fa2f 100644 --- a/src/cascadia/TerminalApp/AppLogic.cpp +++ b/src/cascadia/TerminalApp/AppLogic.cpp @@ -348,7 +348,11 @@ namespace winrt::TerminalApp::implementation } _dialog = dialog; - + // GH#12622: After the dialog is displayed, always clear it out. If we + // don't, we won't be able to display another! + const auto cleanup = wil::scope_exit([this]() { + _dialog = nullptr; + }); // IMPORTANT: This is necessary as documented in the ContentDialog MSDN docs. // Since we're hosting the dialog in a Xaml island, we need to connect it to the // xaml tree somehow.