Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Tab Switcher from increasing Tab refcount #8653

Merged
2 commits merged into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cascadia/TerminalApp/CommandPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,10 @@ namespace winrt::TerminalApp::implementation
{
if (const auto tabPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::TabPaletteItem>() })
{
_SwitchToTabRequestedHandlers(*this, tabPaletteItem.Tab());
if (const auto tab{ tabPaletteItem.Tab() })
{
_SwitchToTabRequestedHandlers(*this, tab);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/TabPaletteItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
namespace winrt::TerminalApp::implementation
{
TabPaletteItem::TabPaletteItem(winrt::TerminalApp::TabBase const& tab) :
_Tab(tab)
_tab(tab)
{
Name(tab.Title());
Icon(tab.Icon());
Expand Down
6 changes: 5 additions & 1 deletion src/cascadia/TerminalApp/TabPaletteItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ namespace winrt::TerminalApp::implementation
TabPaletteItem() = default;
TabPaletteItem(winrt::TerminalApp::TabBase const& tab);

GETSET_PROPERTY(winrt::TerminalApp::TabBase, Tab, nullptr);
winrt::TerminalApp::TabBase Tab() const noexcept
{
return _tab.get();
}

private:
winrt::weak_ref<winrt::TerminalApp::TabBase> _tab;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _tabChangedRevoker;
};
}
Expand Down