Repository: microsoft/terminal (language: cpp)

Issue:
Pasting multiple lines, multiple times is broken in main
After #12517 likely

copy a bunch of lines, like 

```
git cherry-pick 02135ed
git cherry-pick 27a1b9d
git cherry-pick f5f0712
git cherry-pick c0083ef
git cherry-pick 09e9915
git cherry-pick 0a15643
```

and paste em. You'll get the warning, fine. Allow the paste. Now copy some more lines like

```
git cherry-pick 5ba0d61
git cherry-pick c62705e
git cherry-pick 788d33c
```

and paste em. No warning, no paste. One at a time works fine. I'm betting the page is stuck thinking the dialog is open (it's not).

(I bet there are other ways of reproducing this too)


Discussion / hints:

Fix patch:
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.


Test patch: