Merge remote-tracking branch 'origin/dev/migrie/b/1.12-crash-on-exit' into dev/migrie/f/investigate-crashing
This commit is contained in:
commit
3c1866ac53
|
@ -99,9 +99,21 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||||
// The destructor ensures that the last write is flushed to disk before returning.
|
// The destructor ensures that the last write is flushed to disk before returning.
|
||||||
ApplicationState::~ApplicationState()
|
ApplicationState::~ApplicationState()
|
||||||
{
|
{
|
||||||
|
TraceLoggingWrite(g_hSettingsModelProvider,
|
||||||
|
"ApplicationState_Dtor_Start",
|
||||||
|
TraceLoggingDescription("Event at the start of the ApplicationState destructor"),
|
||||||
|
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||||
|
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||||
|
|
||||||
// This will ensure that we not just cancel the last outstanding timer,
|
// This will ensure that we not just cancel the last outstanding timer,
|
||||||
// but instead force it to run as soon as possible and wait for it to complete.
|
// but instead force it to run as soon as possible and wait for it to complete.
|
||||||
_throttler.flush();
|
_throttler.flush();
|
||||||
|
|
||||||
|
TraceLoggingWrite(g_hSettingsModelProvider,
|
||||||
|
"ApplicationState_Dtor_End",
|
||||||
|
TraceLoggingDescription("Event at the end of the ApplicationState destructor"),
|
||||||
|
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||||
|
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-read the state.json from disk.
|
// Re-read the state.json from disk.
|
||||||
|
|
|
@ -819,8 +819,30 @@ winrt::Windows::Foundation::IAsyncAction AppHost::_SaveWindowLayouts()
|
||||||
|
|
||||||
if (_logic.ShouldUsePersistedLayout())
|
if (_logic.ShouldUsePersistedLayout())
|
||||||
{
|
{
|
||||||
const auto layoutJsons = _windowManager.GetAllWindowLayouts();
|
try
|
||||||
_logic.SaveWindowLayoutJsons(layoutJsons);
|
{
|
||||||
|
TraceLoggingWrite(g_hWindowsTerminalProvider,
|
||||||
|
"AppHost_SaveWindowLayouts_Collect",
|
||||||
|
TraceLoggingDescription("Logged when collecting window state"),
|
||||||
|
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||||
|
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||||
|
const auto layoutJsons = _windowManager.GetAllWindowLayouts();
|
||||||
|
TraceLoggingWrite(g_hWindowsTerminalProvider,
|
||||||
|
"AppHost_SaveWindowLayouts_Save",
|
||||||
|
TraceLoggingDescription("Logged when writing window state"),
|
||||||
|
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||||
|
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||||
|
_logic.SaveWindowLayoutJsons(layoutJsons);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
LOG_CAUGHT_EXCEPTION();
|
||||||
|
TraceLoggingWrite(g_hWindowsTerminalProvider,
|
||||||
|
"AppHost_SaveWindowLayouts_Failed",
|
||||||
|
TraceLoggingDescription("An error occured when collecting or writing window state"),
|
||||||
|
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||||
|
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
co_return;
|
co_return;
|
||||||
|
@ -841,6 +863,12 @@ winrt::fire_and_forget AppHost::_SaveWindowLayoutsRepeat()
|
||||||
// per 10 seconds, if a save is requested by another source simultaneously.
|
// per 10 seconds, if a save is requested by another source simultaneously.
|
||||||
if (_getWindowLayoutThrottler.has_value())
|
if (_getWindowLayoutThrottler.has_value())
|
||||||
{
|
{
|
||||||
|
TraceLoggingWrite(g_hWindowsTerminalProvider,
|
||||||
|
"AppHost_requestGetLayout",
|
||||||
|
TraceLoggingDescription("Logged when triggering a throttled write of the window state"),
|
||||||
|
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||||
|
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||||
|
|
||||||
_getWindowLayoutThrottler.value()();
|
_getWindowLayoutThrottler.value()();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue