-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix Android 'Already closed' crash on receipt PDF render #94894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wildan-m
wants to merge
7
commits into
Expensify:main
Choose a base branch
from
wildan-m:wildan/93839-pdf-already-closed-render-crash
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+40
−0
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ff11323
Make PDF renderer honor AlreadyClosedBehavior to stop Already closed …
wildan-m 1ec9aea
Merge remote-tracking branch 'upstream/main' into wildan/93839-pdf-al…
wildan-m 502ec09
Exclude transitive io.legere:pdfiumandroid so the fork dedupes
wildan-m f24922f
Merge remote-tracking branch 'upstream/main' into wildan/93839-pdf-al…
wildan-m b4e5469
Repoint patch 004 to Expensify-org PdfiumAndroidKt
wildan-m 2aeae32
docs(patch 004): add PR-introducing-patch link to match house style
wildan-m 7afeef7
Merge remote-tracking branch 'upstream/main' into wildan/93839-pdf-al…
wildan-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
...act-native-pdf/react-native-pdf+7.0.2+004+point-pdfiumandroid-to-already-closed-fix.patch
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| diff --git a/node_modules/react-native-pdf/android/build.gradle b/node_modules/react-native-pdf/android/build.gradle | ||
| index 7a70e6e..0e94f9c 100644 | ||
| --- a/node_modules/react-native-pdf/android/build.gradle | ||
| +++ b/node_modules/react-native-pdf/android/build.gradle | ||
| @@ -141,8 +141,14 @@ dependencies { | ||
| } | ||
| // NOTE: The original repo at com.github.barteksc is abandoned by the maintainer; there will be no more updates coming from that repo. | ||
| // The repo from zacharee is based on PdfiumAndroidKt, a much newer fork of PdfiumAndroid, with better maintenance and updated native libraries. | ||
| - implementation 'com.github.zacharee:AndroidPdfViewer:4.0.1' | ||
| - // Depend on PdfiumAndroidKt directly so this can be updated independently of AndroidPdfViewer as updates are provided. | ||
| - implementation 'io.legere:pdfiumandroid:1.0.35' | ||
| + // E/App #93839: AndroidPdfViewer pulls io.legere:pdfiumandroid 1.0.35 transitively, whose | ||
| + // PdfDocument.openPage/openTextPage throw "Already closed" instead of honoring AlreadyClosedBehavior.IGNORE | ||
| + // (set by patch 002), crashing the renderer thread when a render races PDF view teardown. Depend on a | ||
| + // JitPack fork that fixes those two methods and exclude the original, so the two coordinates don't ship the | ||
| + // same io.legere.pdfiumandroid.* classes twice. See details.md / patch 004. | ||
| + implementation('com.github.zacharee:AndroidPdfViewer:4.0.1') { | ||
| + exclude group: 'io.legere', module: 'pdfiumandroid' | ||
| + } | ||
| + implementation 'com.github.Expensify:PdfiumAndroidKt:e6c06c2905d1adf8b76f28c7440a2006033ca4c8' | ||
| implementation 'com.google.code.gson:gson:2.13.2' | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Android builds, this dependency is resolving the JitPack root aggregate for a multi-module repo, not the
pdfiumandroidAAR that replacesio.legere:pdfiumandroid. The fork'sjitpack.ymlonly publishes the:pdfiumandroidmodule, and JitPack's module coordinate for that iscom.github.Expensify.PdfiumAndroidKt:pdfiumandroid:<sha>; with the current root coordinate Gradle either cannot resolve the artifact or may pull the aggregate instead of the class-compatible library after the original transitive dependency has been excluded.Useful? React with 👍 / 👎.