saket / telephoto

Building blocks for designing media experiences in Compose UI
https://saket.github.io/telephoto/
Apache License 2.0
998 stars 33 forks source link

IllegalStateException: decodeRegion called on recycled region decoder #107

Closed latsson closed 1 week ago

latsson commented 1 month ago

Hey I'm noticing a bunch of crashes using the library. No idea how to reproduce it though.

          Fatal Exception: java.lang.IllegalStateException: decodeRegion called on recycled region decoder
       at android.graphics.BitmapRegionDecoder.checkRecycled(BitmapRegionDecoder.java:419)
       at android.graphics.BitmapRegionDecoder.decodeRegion(BitmapRegionDecoder.java:357)
       at me.saket.telephoto.subsamplingimage.internal.AndroidImageRegionDecoder$decodeRegion$bitmap$1.invokeSuspend(AndroidImageRegionDecoder.kt:55)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
       at java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at java.lang.Thread.run(Thread.java:1012)

My code (inside a HorizontalPager)

val zoomState = rememberZoomableImageState(
    zoomableState = rememberZoomableState(
        zoomSpec = ZoomSpec(maxZoomFactor = 3f),
    ),
)

ZoomableAsyncImage(
    model = mediaItem.url,
    contentDescription = mediaItem.altText,
    state = zoomState,
)

Version used: telephotoZoomableImageCoil = { module = "me.saket.telephoto:zoomable-image-coil", version = "0.13.0" }

saket commented 1 month ago

I think this is related to https://github.com/saket/telephoto/issues/95 and should be fixed in the next release.

saket commented 1 week ago

Should be fixed with 0.14.0: https://github.com/saket/telephoto/releases/tag/0.14.0