Skip to content

Commit

Permalink
DONT initialize the MediaPlayer
Browse files Browse the repository at this point in the history
I believe this fixes #12383, but I can't seem to find a way to set up a N SKU VM to confirm this.

* [ ] TODO: find such a VM to confirm this doesn't crash on launch.
  • Loading branch information
zadjii-msft committed Feb 10, 2022
1 parent 10c963a commit 0c978f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/cascadia/TerminalApp/Pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,12 @@ winrt::fire_and_forget Pane::_playBellSound(winrt::Windows::Foundation::Uri uri)

if (!_bellPlayer)
{
_bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
// The MediaPlayer might not exist on Windows N SKU.
try
{
_bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
}
CATCH_LOG();
}
if (_bellPlayer)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/Pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Pane : public std::enable_shared_from_this<Pane>

bool _zoomed{ false };

winrt::Windows::Media::Playback::MediaPlayer _bellPlayer;
winrt::Windows::Media::Playback::MediaPlayer _bellPlayer{ nullptr };
winrt::Windows::Media::Playback::MediaPlayer::MediaEnded_revoker _mediaEndedRevoker;

bool _IsLeaf() const noexcept;
Expand Down

0 comments on commit 0c978f5

Please sign in to comment.