Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Opening PDF via URL, and then pressing device back button causes app to crash. #100

Closed
sumit-joshi28 opened this issue Dec 28, 2023 · 9 comments
Labels
bug Something isn't working Stale

Comments

@sumit-joshi28
Copy link

馃摑 Describe the Bug

I am loading one PDF URL and while it is in a loading state, I press the device back button. And then reload the same URL and I am getting this crash. I am using Jetpack Compose PdfRendererViewCompose() to load the URL.

FATAL EXCEPTION: main Process: se.ctek.ctekapp, PID: 7596 java.io.IOException: file not in PDF format or corrupted at android.graphics.pdf.PdfRenderer.nativeCreate(Native Method) at android.graphics.pdf.PdfRenderer.<init>(PdfRenderer.java:172) at com.rajat.pdfviewer.PdfRendererCore.openPdfFile(PdfRendererCore.kt:132) at com.rajat.pdfviewer.PdfRendererCore.<init>(PdfRendererCore.kt:48) at com.rajat.pdfviewer.PdfRendererView.init(PdfRendererView.kt:130) at com.rajat.pdfviewer.PdfRendererView.initWithFile(PdfRendererView.kt:101) at com.rajat.pdfviewer.PdfRendererView$initWithUrl$1.onDownloadSuccess(PdfRendererView.kt:90) at com.rajat.pdfviewer.PdfDownloader.checkAndDownload(PdfDownloader.kt:53) at com.rajat.pdfviewer.PdfDownloader.access$checkAndDownload(PdfDownloader.kt:12) at com.rajat.pdfviewer.PdfDownloader$1.invokeSuspend(PdfDownloader.kt:30) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:367) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1) at com.rajat.pdfviewer.PdfDownloader.<init>(PdfDownloader.kt:30) at com.rajat.pdfviewer.PdfRendererView.initWithUrl(PdfRendererView.kt:78)

馃摉 Library Version

  • version v2.0.4

馃毝 Steps to Reproduce

Please follow these steps to reproduce the issue:

  1. Open PdfViewer with a URL containing pdf.
  2. Before fully loading immediately navigate to the back screen.
  3. Repeat the step 1, you will find a crash.
@sumit-joshi28 sumit-joshi28 added the bug Something isn't working label Dec 28, 2023
Copy link

Thank you for creating your first issue. We appreciate your help in making this project better. We will look into it, and get back to you soon.

@afreakyelf
Copy link
Owner

Hi Do you mind sending me your PDF url, if its not confidential.

@sumit-joshi28
Copy link
Author

This doesn't look like a particular PDF problem, you can check with any large PDF directly loading from the HTTP URL and while it is loading press the back button and load it again, that way you can reproduce the problem.

@sumit-joshi28
Copy link
Author

@afreakyelf Hi, were you able to reproduce the problem?

@DarkAbhi
Copy link

DarkAbhi commented Jan 18, 2024

+1 , works fine on an higer end device i.e S21, crashes on lower end devices like Asus Zenfone Max Pro M1

Update: now it stopped happening. No code changes.

@sumit-joshi28
Copy link
Author

sumit-joshi28 commented Jan 18, 2024

@DarkAbhi Did you try the exact steps as mentioned?

@DarkAbhi
Copy link

@DarkAbhi Did you try the exact steps as mentioned?

Yes.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Feb 22, 2024
@afreakyelf
Copy link
Owner

Great, thanks @DarkAbhi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

3 participants