Skip to content

CarouselView inside CollectionView throws Java.Lang.RuntimeException: 'Canvas: trying to use a recycled bitmap' #11519

@terraslate

Description

@terraslate

Well this one is a real showstopper. Haven't had this happen in the emulator, maybe it is a bit slower, in some ways but it happens on a physical device, Samsung Note 10+. The carousel has two panels, one has 2 images in it, the other has 23. They download from the internet though they are cached, so display is quickish after a second run.

Java.Lang.RuntimeException
Message=Canvas: trying to use a recycled bitmap android.graphics.Bitmap@9383040

I don't think it is related to the visual tree hierarchy I note in the title however I put that in for reference as it may or may not be related. But on further consideration given the nature of the message I decided to check if the page has any duplicate urls, which it is allowed to have btw, and in particular this one does. I suspect the image is destroying and then through the implementation underneath by noting it is the same url it tries to use the same image again, but it is in the process of destroying, hence it crashes.

In my estimation the implementation should wait for it to destroy first before attempting to reuse it, perhaps reference count the uniqueness of it so that it can easily see that the same image coming into view increases to 2 views using it, drops to 1 view using it, and only when it reaches 0 can it then destroy it.

Update: still happens without duplicate images in the list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions