Repository navigation
Fix the intermittent 'Model is disposed!': re-reading open files skips tabs closed meanwhile - #158
Merged
Merged
Conversation
…ouching their released model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the intermittent "Model is disposed!" that failed the tabs flow on CI, on #152 and on #157 (https://github.com/umttur/GlistStudio/actions/runs/37202856344/job/111437927452). #154's stack logging caught where it comes from:
Why:
reloadOpenFiles(src/renderer.ts) reads the open files again from disk after git changed them, on coming back to the window, and after a file was deleted. It takes the list of tabs once, then awaits each file's read in turn. A tab closed during the read of the one before it has had its model released, and the loop then calledisDirtyon it. The check after the read had the same problem, because it testedisDirtybeforeisDisposed. It only shows when reads are slow enough for a tab to close in between, as on CI's runners and on slower machines, which is why it was intermittent.Fix: both checks test for a released model first, then for unsaved changes.
Verified:
tests/e2e/flows/reload-closing.mjs, so CI covers it from now on: three files open, reads slowed by 400 ms, the window's focus triggering the reload, and two tabs closed during it.npm test,tscandeslintpass.🤖 Generated with Claude Code