From 8611d901b6cde48763a0a6c569bed8943780df22 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 26 May 2023 14:31:21 -0500 Subject: [PATCH] Theoretical fix for some crashes (#15457) RE: * #15454 * MSFT:44725712 "WindowsTerminal.exe!NonClientIslandWindow::OnSize" * MSFT:44754014 "NonClientIslandWindow::GetTotalNonClientExclusiveSize" I think this should fix all of those, but I want to ship and verify live, since I can't repro this locally. --- src/cascadia/WindowsTerminal/IslandWindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cascadia/WindowsTerminal/IslandWindow.cpp b/src/cascadia/WindowsTerminal/IslandWindow.cpp index 82f28078f8..5c0e779296 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/IslandWindow.cpp @@ -82,6 +82,16 @@ void IslandWindow::Close() // } + // GH#15454: Unset the user data for the window. This will prevent future + // callbacks that come onto our window message loop from being sent to the + // IslandWindow (or other derived class's) implementation. + // + // Specifically, this prevents a pending coroutine from being able to call + // something like ShowWindow, and have that come back on the IslandWindow + // message loop, where it'll end up asking XAML something that XAML is no + // longer able to answer. + SetWindowLongPtr(_window.get(), GWLP_USERDATA, 0); + if (_source) { _source.Close();