Repository: microsoft/terminal
File: src/cascadia/TerminalApp/Pane.cpp (C++)

Code before:
    // Colors::Transparent! The border won't get Tapped events, and they'll fall
    // through to something else.
    _borderFirst.Tapped([this](auto&, auto& e) {
        _FocusFirstChild();
        e.Handled(true);
    });
    _borderSecond.Tapped([this](auto&, auto& e) {
        _FocusFirstChild();
        e.Handled(true);
    });

    if (!s_bellPlayer)
    {
        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
                // lifetime of the app anyways, and it'll get cleaned up when the
                // Terminal is closed, so whatever.
                winrt::Windows::Media::Playback::MediaPlayer p{ s_bellPlayer };
                ::winrt::detach_abi(p);
            }
        }
        CATCH_LOG();
    }
}

Pane::Pane(std::shared_ptr<Pane> first,
           std::shared_ptr<Pane> second,
           const SplitState splitState,
           const float splitPosition,
           const bool lastFocused) :
    _firstChild{ first },
    _secondChild{ second },
    _splitState{ splitState },
    _desiredSplitPosition{ splitPosition },

Review comment (suggestion):
```suggestion
                // the way a MediaPlayer gets torn down. At time of writing (Nov
```

Code after:
    // Colors::Transparent! The border won't get Tapped events, and they'll fall
    // through to something else.
    _borderFirst.Tapped([this](auto&, auto& e) {
        _FocusFirstChild();
        e.Handled(true);
    });
    _borderSecond.Tapped([this](auto&, auto& e) {
        _FocusFirstChild();
        e.Handled(true);
    });

    if (!s_bellPlayer)
    {
        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 of 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
                // lifetime of the app anyways, and it'll get cleaned up when the
                // Terminal is closed, so whatever.
                winrt::Windows::Media::Playback::MediaPlayer p{ s_bellPlayer };
                ::winrt::detach_abi(p);
            }
        }
        CATCH_LOG();
    }
}

Pane::Pane(std::shared_ptr<Pane> first,
           std::shared_ptr<Pane> second,
           const SplitState splitState,
           const float splitPosition,
           const bool lastFocused) :
    _firstChild{ first },
    _secondChild{ second },
    _splitState{ splitState },
    _desiredSplitPosition{ splitPosition },