Skip to content

Conversation

sarbogast
Copy link

When calling android.graphics.pdf.PdfRenderer.close() when switching from one PDF document to another one quickly.

This bug is hard to replicate because it apparently involves a race condition when switching the PDF document of a SfPdfViewer very quickly, which means the former PDF document renderer was not closed yet when the new one is opened.

The Android plugin calls android.graphics.pdf.PdfRenderer.close(), which itself calls throwIfPageOpened() here, which can throw an IllegalStateException. And since this exception is not caught by the plugin, it could crash the application and I've seen it pop up randomly in my users' logs.

Swallowing this exception is similar to swallowing the IOException, which is already done in the same place in the code.

…id.graphics.pdf.PdfRenderer.close() when switching from one PDF document to another one quickly
@ramkumarsync
Copy link
Collaborator

We are closing this PR, as the changes are already made in the Flutter pdf viewer source.

@sfHariHaraSudhan sfHariHaraSudhan added pdf viewer PDF viewer component solved Solved the query using existing solutions labels Jul 7, 2025
@syncfusion syncfusion locked and limited conversation to collaborators Jul 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pdf viewer PDF viewer component solved Solved the query using existing solutions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants