SIGN IN SIGN UP

[web] Don't close image source too early (#57200)

A `CkImage` instance holds a reference to `ImageSource?`. When that `CkImage` gets cloned, the `ImageSource` instance becomes shared between the original `CkImage` and its new clone. Then when one of the `CkImage`s gets disposed of, it closes the shared `ImageSource` leaving other live `CkImage`s holding on to a closed `ImageSource`.

The quick solution to this is to have a ref count on the `ImageSource` to count how many `CkImage`s are referencing it. The `ImageSource` will only be closed if its ref count reaches 0.

Fixes https://github.com/flutter/flutter/issues/160199
Fixes https://github.com/flutter/flutter/issues/158093
M
Mouad Debbar committed
52664aa344fc0880d198e8fe17cfaf41c2f25f61
Parent: 0dfbd04
Committed by GitHub <noreply@github.com> on 12/16/2024, 7:10:17 PM