saket / telephoto

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

Reading of images from Coil's disk cache is leaking snapshot editors #13

Closed saket closed 1 year ago

saket commented 1 year ago

Coil's documentation states that usages of DiskCache#get will leak snapshot editors if they aren't closed.

IMPORTANT: You must call either [Snapshot.close] or [Snapshot.closeAndEdit] when finished reading the snapshot. An open snapshot prevents editing the entry or deleting it on disk.

Telephoto will need to find a way to dispose cache snapshots when the image is no longer being displayed.

https://github.com/saket/telephoto/blob/306ff181c417e9751a724f4ceb80ed4834ec5ba1/zoomable-image/coil/src/main/kotlin/me/saket/telephoto/zoomable/coil/CoilImageSource.kt#L133