π Describe the Bug
Iβm using Jetpack Compose. When I show or hide a PdfRendererViewCompose using a if condition, the app may crash if the PdfRendererViewCompose has not finished rendering its page β for example, if the PDF is still loading or the user is switching to the next page and rendering is in progress.
The crash does not provide a detailed stack trace. The only output in logcat is:
Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x70 in tid 13729 (DefaultDispatch), pid 13679 (x)
π Library Version
2.3.7
πΆ Steps to Reproduce
Please follow these steps to reproduce the issue:
- Display a
PdfRendererViewCompose in a Compose screen.
- Start loading a PDF or scroll to switch pages.
- While rendering is in progress, trigger the
if condition to remove or hide the PdfRendererViewCompose.
π€ Expected Behavior
Confirm if my usage issue is still the current problem with PdfViewer
π» Code Snippets
if (showPdf && viewModel.pdfFile != null) {
var loadingPdf by remember { mutableStateOf(true) }
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(0xCC222222)),
contentAlignment = Alignment.BottomCenter
) {
Box(
modifier = Modifier
.padding(36.dp)
.size(64.dp)
.clip(CircleShape)
.background(Color(0x80FFFFFF))
.align(Alignment.TopStart)
.clickable {
showPdf = false
viewModel.pdfFile = null
}
) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = null,
tint = Color.White,
modifier = Modifier
.fillMaxSize()
.padding(12.dp)
)
}
Box(
modifier = Modifier
.fillMaxHeight()
.aspectRatio(0.75f)
) {
if (loadingPdf) {
CircularProgressIndicator(
color = Color.White, modifier = Modifier
.size(128.dp)
.align(Alignment.Center)
)
}
PdfRendererViewCompose(
source = PdfSource.LocalFile(viewModel.pdfFile!!.file),
lifecycleOwner = LocalLifecycleOwner.current,
cacheStrategy = CacheStrategy.DISABLE_CACHE,
statusCallBack = object : PdfRendererView.StatusCallBack {
override fun onPdfLoadStart() {
Log.d("xxxPDF", "onPdfLoadStart")
}
override fun onPdfLoadProgress(progress: Int, downloadedBytes: Long, totalBytes: Long?) {
Log.d("xxxPDF", "onPdfLoadProgress: progress= ${progress}, downloadedBytes= ${downloadedBytes}, totalBytes= $totalBytes")
}
override fun onPdfLoadSuccess(absolutePath: String) {
Log.d("xxxPDF", "onPdfLoadSuccess: absolutePath= $absolutePath")
}
override fun onError(error: Throwable) {
Log.d("xxxPDF", "onError: error= ${error.stackTraceToString()}")
}
override fun onPageChanged(currentPage: Int, totalPage: Int) {
Log.d("xxxPDF", "onPageChanged: currentPage= ${currentPage}, totalPage= $totalPage")
}
override fun onPdfRenderStart() {
Log.d("xxxPDF", "onPdfRenderStart")
}
override fun onPdfRenderSuccess() {
Log.d("xxxPDF", "onPdfRenderSuccess")
}
},
modifier = Modifier.fillMaxSize()
)
}
}
}
π Log Output/Stack Trace
Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x70 in tid 13729 (DefaultDispatch), pid 13679 (x)
π Describe the Bug
Iβm using Jetpack Compose. When I show or hide a
PdfRendererViewComposeusing aifcondition, the app may crash if thePdfRendererViewComposehas not finished rendering its page β for example, if the PDF is still loading or the user is switching to the next page and rendering is in progress.The crash does not provide a detailed stack trace. The only output in
logcatis:π Library Version
2.3.7
πΆ Steps to Reproduce
Please follow these steps to reproduce the issue:
PdfRendererViewComposein a Compose screen.ifcondition to remove or hide thePdfRendererViewCompose.π€ Expected Behavior
Confirm if my usage issue is still the current problem with PdfViewer
π» Code Snippets
π Log Output/Stack Trace