fix/DynamicFontModule - double callback invocation causing SIGABRT on Android#4030
Merged
adids1221 merged 3 commits intoJul 19, 2026
Merged
Conversation
… Android The `finally` block unconditionally called `callback.invoke(null, name)` after every execution path, including after the `catch` block already invoked the callback on error. React Native enforces single-use callbacks and throws a fatal SIGABRT when a callback is invoked more than once. Fix: move the success callback into the `try` block and remove the `finally`. The callback is now invoked exactly once — on success inside `try`, or on failure inside `catch`. Reproduces intermittently on Android (branded apps) when an exception is thrown during font loading (e.g. `Typeface.createFromFile` failing on certain devices), causing the app to crash ~4 seconds after launch before any UI interaction.
mika-bejerano
force-pushed
the
fix/dynamic-font-module-double-callback
branch
from
July 12, 2026 11:08
f730c24 to
cb34a75
Compare
…tion on bridge teardown Previously callback.invoke(null, name) was inside the try block, meaning any RuntimeException thrown by the RN bridge during invocation (e.g. activity destroyed mid-load) would be caught and trigger a second callback.invoke() call — reproducing the same SIGABRT this PR was fixing. Moving it after the try/catch with an early return in catch guarantees exactly-once invocation in all paths.
Commit 7e431eb accidentally introduced a space between `catch` and `(Exception e)` that was not present in the original code style of this file. This reverts that whitespace-only change to keep the diff minimal and consistent with the surrounding code style.
mika-bejerano
force-pushed
the
fix/dynamic-font-module-double-callback
branch
from
July 16, 2026 17:30
1a69a2b to
497edfa
Compare
adids1221
approved these changes
Jul 19, 2026
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.
Description
DynamicFontModule.loadFont(Android) had acatch/finallystructure where both blocks invoked the React Native callback, causing a fatal crash when an exception occurred during font loading.Root cause:
React Native enforces that native callbacks are invoked exactly once. When any exception is thrown during font loading (e.g.
Typeface.createFromFilefailing on certain Android devices), bothcatchandfinallyfire, invoking the callback twice and triggering a fatalSIGABRT:Fix: Move the success callback into the
tryblock and remove thefinally. The callback is now invoked exactly once — success path insidetry, error path insidecatch.