Fix crash on startup when a session file cannot be read - #1123
Merged
dail8859 merged 1 commit intoSep 12, 2026
Merged
Conversation
ScintillaNext::fromFile() returns a null pointer when the file cannot be read from disk, but SessionManager used the returned pointer without checking it. A session referencing a file that exists but cannot be opened, for example after macOS resets folder access permissions following an upgrade, dereferenced the null pointer in EditorManager::setupEditor() and crashed the application during startup before the main window was shown. This happened on every launch, leaving no way to recover other than deleting the settings. Guard the three fromFile() call sites so an unreadable file is skipped and a warning is logged, which is what EditorManager::createEditorFromFile() already does. Also guard the two findChild<BookMarkDecorator*>() results, which can also return null. Fixes dail8859#845
Contributor
Author
|
Heads up on the two failing checks — I believe both are pre-existing on
Everything that currently passes on |
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.
ScintillaNext::fromFile()returns a null pointer when the file cannot be read fromdisk, but
SessionManagerused the returned pointer without checking it.If a session references a file that still exists but cannot be opened — for example
after macOS resets folder access permissions following an upgrade — the null pointer
is dereferenced in
EditorManager::setupEditor()and the application crashes duringstartup, before the main window is shown. It then crashes on every subsequent launch,
leaving no way to recover other than deleting the settings.
This guards the three
fromFile()call sites so an unreadable file is skipped and awarning logged, which is what
EditorManager::createEditorFromFile()already does.It also guards the two
findChild<BookMarkDecorator*>()results, which can alsoreturn null — that is the code path in the crash log attached to the issue.
Testing
macOS 26.6, Qt 6.11.2, Debug build. Created a session referencing a
chmod 000file:EXC_BAD_ACCESS (code=1, address=0x0)atScintillaEdit::clearCmdKey(this=0x0, keyDefinition=309)could not be read from disk, ignoring this file for session loading,and skips the file
Also verified a readable session file still restores normally, including bookmarks
round-tripping correctly through save and load.
Fixes #845