Skip to content

Commit

Permalink
Add some tracelogging to find a heisenbug that might not have ever be…
Browse files Browse the repository at this point in the history
…en there
  • Loading branch information
zadjii-msft committed Apr 16, 2021
1 parent 71577fc commit f892752
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cascadia/WindowsTerminal/AppHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AppHost
bool _shouldCreateWindow{ false };
winrt::Microsoft::Terminal::Remoting::WindowManager _windowManager{ nullptr };

std::vector<winrt::Microsoft::Terminal::Control::KeyChord> _hotkeys{ nullptr };
std::vector<winrt::Microsoft::Terminal::Control::KeyChord> _hotkeys{};
winrt::Windows::Foundation::Collections::IMap<winrt::Microsoft::Terminal::Control::KeyChord, winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs> _hotkeyActions{ nullptr };

void _HandleCommandlineArgs();
Expand Down
14 changes: 12 additions & 2 deletions src/cascadia/WindowsTerminal/IslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,10 +910,15 @@ void IslandWindow::_SetIsFullscreen(const bool fullscreenEnabled)
// - <none>
void IslandWindow::UnsetHotkeys(const std::vector<winrt::Microsoft::Terminal::Control::KeyChord>& hotkeyList)
{
TraceLoggingWrite(g_hWindowsTerminalProvider,
"UnsetHotkeys",
TraceLoggingDescription("Emitted when clearing previously set hotkeys"),
TraceLoggingInt64(hotkeyList.size(), "numHotkeys", "The number of hotkeys to unset"),
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));

for (int i = 0; i < hotkeyList.size(); i++)
{
LOG_IF_WIN32_BOOL_FALSE(UnregisterHotKey(_window.get(),
1));
LOG_IF_WIN32_BOOL_FALSE(UnregisterHotKey(_window.get(), i));
}
}

Expand All @@ -928,6 +933,11 @@ void IslandWindow::UnsetHotkeys(const std::vector<winrt::Microsoft::Terminal::Co
// - <none>
void IslandWindow::SetGlobalHotkeys(const std::vector<winrt::Microsoft::Terminal::Control::KeyChord>& hotkeyList)
{
TraceLoggingWrite(g_hWindowsTerminalProvider,
"SetGlobalHotkeys",
TraceLoggingDescription("Emitted when setting hotkeys"),
TraceLoggingInt64(hotkeyList.size(), "numHotkeys", "The number of hotkeys to set"),
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
int index = 0;
for (const auto& hotkey : hotkeyList)
{
Expand Down

1 comment on commit f892752

@github-actions

This comment was marked as outdated.

Please sign in to comment.