Settings: fixed Windows not honoring DiscardWhenMissingDate. (#9460)

This commit is contained in:
ocornut 2026-07-07 22:52:47 +02:00
parent 112d6d9eab
commit f903a7e8e2

View File

@ -15904,9 +15904,10 @@ static void WindowSettingsHandler_Cleanup(ImGuiContext* ctx, ImGuiSettingsHandle
ImGuiContext& g = *ctx; ImGuiContext& g = *ctx;
for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
{ {
if (args->_DiscardOlderThanDate != 0 && settings->LastUsedDate.Unpack() < args->_DiscardOlderThanDate) const bool is_valid = settings->LastUsedDate.IsValid();
if ((args->_DiscardOlderThanDate != 0 && settings->LastUsedDate.Unpack() < args->_DiscardOlderThanDate) || (args->DiscardWhenMissingDate && !is_valid))
settings->WantDelete = true; settings->WantDelete = true;
if (args->SetCurrentSessionDateToAll || (args->SetCurrentSessionDateWhenMissingDate && settings->LastUsedDate.IsValid() == false)) if (args->SetCurrentSessionDateToAll || (args->SetCurrentSessionDateWhenMissingDate && !is_valid))
settings->LastUsedDate = g.SessionDate; settings->LastUsedDate = g.SessionDate;
} }
} }