Fix leaking the contents of the first tab in the first window (#18621)

Found this one completely randomly.

## Validation Steps Performed
* Open 2 windows with 1 tab each
* Click the X button on the tab in the 1st window
* OpenConsole/etc. is cleaned up 

---------

Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
This commit is contained in:
Leonard Hecker 2025-02-24 10:27:36 -08:00 committed by GitHub
parent 4bcdd7a844
commit c7f0d0addb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -95,6 +95,12 @@ void IslandWindow::Close()
if (_source)
{
// BODGY
// WinUI will strongly hold onto the first DesktopWindowXamlSource that is created.
// If we don't manually set the Content() to null first, closing that first window
// will leak all of its contents permanently.
_source.Content(nullptr);
_source.Close();
_source = nullptr;
}