Prevent blank-screen launch when the auto-start registry key is missing (Windows)#2239
Open
jabagawee wants to merge 2 commits into
Open
Prevent blank-screen launch when the auto-start registry key is missing (Windows)#2239jabagawee wants to merge 2 commits into
jabagawee wants to merge 2 commits into
Conversation
On a fresh Windows install the HKEY_CURRENT_USER CurrentVersion\Run key may not exist yet. The launch_at_startup package opens that key in isEnabled() without handling its absence, so it throws a WindowsException instead of returning false, and the exception propagates out of the auto start notifier's build(). This commit wraps the isEnabled() call in _isEnabledSafe(), which treats any read failure as disabled. A missing key means auto start is not registered, so false is the correct status. The periodic updateStatus() refresh uses the same guard.
The auto start service initialized through _init, which rethrows on failure. A throw there aborts lazyBootstrap before runApp() is reached, leaving the app on a blank screen with no UI. This commit switches it to _safeInit so a failure is logged and swallowed instead of aborting startup, matching how the system tray and other non-critical desktop services are already initialized. Auto start is not required for the app to run, so its failure should not prevent launch.
|
! |
|
If this works, a great find! |
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.
Problem
On Windows,
AutoStartNotifier.build()awaitslaunchAtStartup.isEnabled(), which readsHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. Thelaunch_at_startuppackage opens that key without handling its absence, so on a fresh Windows install where no application has registered a startup entry yet and the key does not exist, it throws instead of returningfalse.That throw propagates out of
build(), and bootstrap initializes the auto start service through_init, which rethrows. The rethrow abortslazyBootstrapbeforerunApp()is reached, so the app shows a blank screen with no UI.Fix
auto_start_notifier.dart: read the status through a new_isEnabledSafe()that treats any read failure as disabled. A missing key means auto start is not registered, sofalseis the correct status. The periodicupdateStatus()refresh uses the same guard.bootstrap.dart: initialize the auto start service through_safeInitinstead of_init, matching the system tray and other non-critical desktop services, so its failure cannot prevent launch.