Repository navigation
Persistence fix on app exit/start + Highlight dialog Import/Export error fix - #662
Pr0metheus2 wants to merge 2 commits into
Conversation
Bug Fix : - .lxp persistence on exit when automatic saving and filter-tab restoration are enabled. - Save the live filter UI state before shutdown teardown, so FilterParamsList is no longer written empty or stale. - Prevent close-time tab disposal from overwriting the already saved snapshot. Added: - a regression test covering the snapshot behavior.
- Fix the Highlight dialog export button by correcting the SaveFileDialog.Filter resource string.
- The filter now uses valid description|pattern pairs, so exporting highlight groups no longer throws an
ArgumentException.
- Update the localized resources consistently so the export dialog works in all supported languages.
| return snapshot; | ||
| } | ||
|
|
||
| private FilterParams CaptureCurrentFilterParams () |
There was a problem hiding this comment.
Duplicated Code — CaptureCurrentFilterParams() repeats the controls→FilterParams copy shape already present at ~4420–4440 (FilterSearch) and again in the dirty-check at ~4770–4795. Three sites now share the shape; one helper is warranted — though "Surgical Changes" partially excuses not touching the pre-existing sites.
There was a problem hiding this comment.
Thanks. I agree the duplication is real, but I kept this commit "surgical" and only touched the new capture path.
| GC.SuppressFinalize(this); | ||
| } | ||
|
|
||
| private void Dispose (bool disposing) |
There was a problem hiding this comment.
Duplicated Code / Speculative Generality (tests) — the test fixture implements a full Dispose(bool)/_disposed pattern that duplicates its own TearDown; possibly analyzer-driven (NUnit1032), but the guard-flag pattern is overkill either way.
There was a problem hiding this comment.
Yes, mostly style noise, but it is not a product bug.
| { | ||
| SetText("filterComboBox", "LIVE_FILTER_TEXT"); | ||
| SetText("filterRangeComboBox", "LIVE_RANGE_TEXT"); | ||
| SetChecked("filterCaseSensitiveCheckBox", true); |
There was a problem hiding this comment.
Speculative Generality (tests) — SetChecked/SetValue use reflection (GetProperty("Checked")) on controls that could be typed directly.
There was a problem hiding this comment.
Mostly style noise, not a correctness issue.
| /// </summary> | ||
| [Browsable(false)] | ||
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] | ||
| internal bool SkipPersistenceSaveOnClose { get; set; } |
There was a problem hiding this comment.
Control-flag coupling — LogTabWindow mutates SkipPersistenceSaveOnClose on children before closing them; a Close(savePersistence: false) path would avoid the mutable flag.
There was a problem hiding this comment.
Agree that a Close(savePersistence: false) would be cleaner. I used the existing flag here to avoid widening the close-path change in this commit and to keep the behavior isolated.
| @@ -0,0 +1,166 @@ | |||
| using System.Reflection; | |||
There was a problem hiding this comment.
"Added: a regression test covering the snapshot behavior." — Partial. The test covers only the live-UI capture in GatherSessionSnapshot. Neither of the other two claims is tested: nothing exercises "Save the live filter UI state before shutdown teardown" (the ordering in OnLogTabWindowFormClosing), and SkipPersistenceSaveOnClose is never touched by any test.
".lxp persistence on exit/start" — the "start" half has no changes; the restore path (RestoreFilters, [LogWindow.cs:2677] already used FilterParamsList[0], so exit-side changes alone plausibly complete the fix.
There was a problem hiding this comment.
You are right, “exit/start” is only partially backed by tests. The fix is primarily on the save/exit side, not on restore logic.
| </data> | ||
| <data name="HighlightDialog_UI_Export_Filter" xml:space="preserve"> | ||
| <value>Settings (*.json)|*.json|All files (*.*)</value> | ||
| <value>Settings (*.json)|*.json|All files (*.*)|*.*</value> |
There was a problem hiding this comment.
This is a fix for export, not import! Import already has it.
| } | ||
|
|
||
| SavePersistenceData(false); | ||
| if (!SkipPersistenceSaveOnClose) |
There was a problem hiding this comment.
"Prevent close-time tab disposal from overwriting the already saved snapshot." — Works for the guarded path (pre-save runs before RemoveAndDisposeLogWindow, and OnLogWindowClosing at [LogWindow.cs:917] (skips the re-save). But the flag is set-only and never reset — if FormClosing is ever cancelled after the handler runs, surviving windows silently skip persistence on all later manual tab closes. Also Reload() ([LogWindow.cs:7420] and ReloadNewFile() call SavePersistenceData(false) unguarded — a rollover firing mid-shutdown could still overwrite the snapshot. Narrow races, worth noting.
There was a problem hiding this comment.
Could be a concern. The flag is only set in the app shutdown cascade, immediately before the pre-save and disposal sequence. I don’t see a normal path where it remains active after that close flow completes.
This is relevant if the close cascade aborts or throws before disposal completes. LogTabWindow does swallow these exceptions in its close handler.
| /// snapshot after child filter tabs have already been torn down. | ||
| /// </summary> | ||
| [Browsable(false)] | ||
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] |
There was a problem hiding this comment.
[Browsable(false)]/[DesignerSerializationVisibility] on SkipPersistenceSaveOnClose are speculative decoration; LogWindow is never designer-hosted with this property.
There was a problem hiding this comment.
It looks unnecessary because this is not a designer-driven surface, but it is harmless metadata, not a correctness issue. I would treat it as cleanup, not a defect. They are not behavior-changing.
|
If you recommend, I can close this pull request and start over again with small individual steps. |


Bug Fix :
Added: