fix(image_layers) image layers crash on Android#119
Conversation
hm21
left a comment
There was a problem hiding this comment.
Thanks for the PR! I looked into the Bitmap.scale() extension from androidx.core.graphics it delegates to Bitmap.createScaledBitmap(), which returns the same object when width and height already match. So calling recycle() on that would indeed crash. The defensive !== check in change 1 (line ~92) is a valid fix for that edge case.
However, I want to point out that change 2 (line ~110) is logically redundant, the scale() call is already inside an if block that checks sizedBitmap.width != videoWidth || sizedBitmap.height != videoHeight, so at least one dimension always differs, meaning createScaledBitmap will always return a new object there. The added guard can never trigger. It's harmless but i think it's unnecessary. Could you try remove it and check if it's still crash then?
…oid_image_recycle # Conflicts: # android/src/main/kotlin/ch/waio/pro_video_editor/src/features/render/helpers/ApplyImageLayer.kt
You are right. Though apparently the check for "same image" in the Also noticed that generate thumbnails code doesn't do Let me know if you don't want these changes. I'll revert. |
Description
Related Issue: Closes #118
Type of Change