mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-11 04:38:24 -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 ✅ (cherry picked from commit 69fc2d94ee7a138e71fc7a4c2e2f045f3ee628c8) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgaZGpY Service-Version: 1.23
This commit is contained in:
parent
9476d0f9fa
commit
90a55ed3d9
@ -925,9 +925,15 @@ void WindowEmperor::_finalizeSessionPersistence() const
|
|||||||
{
|
{
|
||||||
const auto state = ApplicationState::SharedInstance();
|
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);
|
state.PersistedWindowLayouts(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_forcePersistence || _app.Logic().Settings().GlobalSettings().ShouldUsePersistedLayout())
|
||||||
|
{
|
||||||
for (const auto& w : _windows)
|
for (const auto& w : _windows)
|
||||||
{
|
{
|
||||||
w->Logic().PersistState();
|
w->Logic().PersistState();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user