Work around macOS startup crash in irondash_engine_context#264
Open
teamleaderleo wants to merge 1 commit into
Open
Work around macOS startup crash in irondash_engine_context#264teamleaderleo wants to merge 1 commit into
teamleaderleo wants to merge 1 commit into
Conversation
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.
Summary
Works around an immediate native startup crash on macOS caused by a race
condition in
irondash_engine_context0.5.5.TriOS receives
irondash_engine_contexttransitively through itsdrag-and-drop dependencies. The currently published package and upstream
mainbranch register the macOS engine context asynchronously, allowingsuper_native_extensionsto request the Flutter view before the context hasbeen stored.
This PR temporarily overrides the transitive dependency with a tested fork
commit that:
Related upstream work
[macOS] Crash on startup: objc_loadWeakRetained in getFlutterView due to race condition in irondash_engine_context irondash/irondash#81
orestesgaolin/irondash@220bd91
https://github.com/irondash/irondash/blob/main/engine_context/dart/macos/Classes/EngineContextPlugin.m
Reproduction environment
maindependenciessuper_drag_and_drop0.9.1super_native_extensions0.9.1irondash_engine_context0.5.5Failure behavior
Before this change:
EXC_BAD_ACCESSat address0x8IrondashEngineContextPlugin.getFlutterViewsuper_native_extensionswhile initializing thestartup drag-and-drop region
The context is inserted into the Irondash registry using
dispatch_async(dispatch_get_main_queue(), ...), while the drag-and-dropplugin can request the Flutter view synchronously before that queued block has
run.
Change
Adds a
dependency_overridesentry forirondash_engine_contextpointing tothe tested fork commit:
220bd911fae213282932b964322f9cc4c274f649No TriOS application code is changed.
Testing
After the change:
flutter pub getsucceedsflutter build macos --release --no-tree-shake-iconssucceedsFollow-up
This is intended as a temporary downstream workaround. The dependency is
pinned to a specific, inspected commit, and the Git override should be replaced
with an official pub.dev release once the fix is merged upstream and published.
Alternative downstream mitigation and regression testing
TriOS currently wraps its main application body in
DragDropHandler, whichcreates a whole-window
DropRegionduring the initial widget build.As an alternative to the Git dependency override, TriOS could explore a
macOS-specific initialization path that defers creation of the
DropRegionuntil after the first Flutter frame, or until the native engine context is
known to be available. A fixed delay or first-frame callback would still be a
timing-based workaround, so the underlying dependency should ultimately
handle early context access safely.
A useful regression test for the original failure would be a macOS launch
smoke test that:
.app;A normal Flutter widget test would probably not reproduce this crash because
the failure occurs during native AppKit/plugin registration rather than purely
inside the Dart widget tree.
TriOS already has Intel and Apple Silicon macOS build jobs, but the current
workflow runs on tag pushes rather than pull requests. A PR-triggered macOS
launch smoke test could catch this class of startup regression before a
release.