mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Clean up persisted windows after the feature is disabled (#18910)
I finally realized the missing piece. We need to clear the state array unconditionally, as otherwise it won't get cleared. Duh. Closes #18584 ## Validation Steps Performed * Craft a state.json with a layout * Launch Terminal while the feature is disabled * state.json is cleaned up on exit ✅
This commit is contained in:
parent
14993db1cb
commit
69fc2d94ee
@ -925,9 +925,15 @@ void WindowEmperor::_finalizeSessionPersistence() const
|
||||
{
|
||||
const auto state = ApplicationState::SharedInstance();
|
||||
|
||||
if (_forcePersistence || _app.Logic().Settings().GlobalSettings().ShouldUsePersistedLayout())
|
||||
// Calling an `ApplicationState` setter triggers a write to state.json.
|
||||
// With this if condition we avoid an unnecessary write when persistence is disabled.
|
||||
if (state.PersistedWindowLayouts())
|
||||
{
|
||||
state.PersistedWindowLayouts(nullptr);
|
||||
}
|
||||
|
||||
if (_forcePersistence || _app.Logic().Settings().GlobalSettings().ShouldUsePersistedLayout())
|
||||
{
|
||||
for (const auto& w : _windows)
|
||||
{
|
||||
w->Logic().PersistState();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user