saket / telephoto

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

IllegalStateException: getWidth called on recycled region decoder #100

Closed RadoslawGorczyca closed 2 months ago

RadoslawGorczyca commented 2 months ago

I have a HorizontalPager of zoomable pictures. I noticed that quite often when you swipe from first picture to the next, then back to the first picture and try to double-tap to zoom, you get this crash. It happens even in other situations when scrolling through pager and zooming. Would really appreciate some help :)

Log:


java.lang.IllegalStateException: getWidth called on recycled region decoder
  at android.graphics.BitmapRegionDecoder.checkRecycled(BitmapRegionDecoder.java:303)
  at android.graphics.BitmapRegionDecoder.getWidth(BitmapRegionDecoder.java:255)
  at me.saket.telephoto.subsamplingimage.internal.AndroidImageRegionDecoder.size-YEO4UFw(AndroidImageRegionDecoder.kt:80)
  at me.saket.telephoto.subsamplingimage.internal.AndroidImageRegionDecoder.decodeRegion(AndroidImageRegionDecoder.kt:50)
  at me.saket.telephoto.subsamplingimage.internal.PooledImageRegionDecoder$decodeRegion$2.invokeSuspend(PooledImageRegionDecoder.kt:25)
  at me.saket.telephoto.subsamplingimage.internal.PooledImageRegionDecoder$decodeRegion$2.invoke(Unknown Source:8)
  at me.saket.telephoto.subsamplingimage.internal.PooledImageRegionDecoder$decodeRegion$2.invoke(Unknown Source:4)
  at me.saket.telephoto.subsamplingimage.internal.ResourcePool.borrow(PooledImageRegionDecoder.kt:81)
  at me.saket.telephoto.subsamplingimage.internal.ResourcePool$borrow$1.invokeSuspend(Unknown Source:15)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
  at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
  at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
  Suppressed: java.lang.IllegalStateException: getWidth called on recycled region decoder
      ... 17 more
  Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@d9f5671, androidx.compose.runtime.BroadcastFrameClock@5946c56, StandaloneCoroutine{Cancelling}@9b884d7, Dispatchers.IO]```

@saket Unfortunately this bug still remains, with the same log.

RadoslawGorczyca commented 2 months ago

bump

saket commented 2 months ago

Closing this issue and reopening https://github.com/saket/telephoto/issues/95 instead.