Skip to content

Commit 1d25267

Browse files
authored
fix(mobile): buffer width/height referenced after recycling (immich-app#26415)
recycle after getters
1 parent a4d95b7 commit 1d25267

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mobile/android/app/src/main/kotlin/app/alextran/immich/images/LocalImagesImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ fun Bitmap.toNativeBuffer(): Map<String, Long> {
4848
try {
4949
val buffer = NativeBuffer.wrap(pointer, size)
5050
copyPixelsToBuffer(buffer)
51-
recycle()
5251
return mapOf(
5352
"pointer" to pointer,
5453
"width" to width.toLong(),
@@ -57,8 +56,9 @@ fun Bitmap.toNativeBuffer(): Map<String, Long> {
5756
)
5857
} catch (e: Exception) {
5958
NativeBuffer.free(pointer)
60-
recycle()
6159
throw e
60+
} finally {
61+
recycle()
6262
}
6363
}
6464

0 commit comments

Comments
 (0)