Skip to content

Commit

Permalink
DON'T default-construct the MediaPlayer (#12463)
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: wait till the morning to finish copying the N vhd I found off the build shares, to confirm this doesn't crash on launch.
  • Loading branch information
zadjii-msft authored Feb 15, 2022
1 parent 5ba0d61 commit 2cf46d4
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 2cf46d4

Please sign in to comment.