it's BODGY time

This commit is contained in:
Mike Griese 2021-11-16 09:51:33 -06:00
parent 02344048de
commit 93937533bc
2 changed files with 22 additions and 1 deletions

View File

@ -76,6 +76,27 @@ Pane::Pane(const Profile& profile, const TermControl& control, const bool lastFo
try
{
s_bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
if (s_bellPlayer)
{
// BODGY
//
// Manually leak a ref to the MediaPlayer we just instantiated.
// We're doing this just like the way we do in AppHost with the
// App itself.
//
// We have to do this because there's some bug in the OS with
// the way a MediaPlayer gets torn down. At time fo writing (Nov
// 2021), if you search for `remove_SoundLevelChanged` in the OS
// repo, you'll find a pile of bugs.
//
// We tried moving the MediaPlayer singleton up to the
// TerminalPage, but alas, that teardown had the same problem.
// So _whatever_. We'll leak it here. It needs to last the
// lifetim of the app anyways, and it'll get cleaned up when the
// Termnial is closed, so whatever.
winrt::Windows::Media::Playback::MediaPlayer p{ s_bellPlayer };
::winrt::detach_abi(p);
}
}
CATCH_LOG();
}

View File

@ -348,7 +348,7 @@ void AppHost::Initialize()
_window->SetContent(_logic.GetRoot());
_window->OnAppInitialized();
// THIS IS A HACK
// BODGY
//
// We've got a weird crash that happens terribly inconsistently, but pretty
// readily on migrie's laptop, only in Debug mode. Apparently, there's some