Skip to content

fix: don't drop the Image twice per recycle - #169

Open
mrousavy wants to merge 1 commit into
mainfrom
fix/idempotent-drop-image
Open

fix: don't drop the Image twice per recycle#169
mrousavy wants to merge 1 commit into
mainfrom
fix/idempotent-drop-image

Conversation

@mrousavy

Copy link
Copy Markdown
Owner

prepareForRecycle() calls onDisappear()/willHide() directly, but the view has already been removed from its window at that point, which fired the visibility callback and called it once already. So every recycle ran imageLoader.dropImage(..) twice.

Harmless with the built-in HybridImageLoader (it just nils the image), but dropImage is part of the public HybridImageLoaderSpec - any third-party loader that refcounts, cancels, or releases a cache entry in dropImage gets an unbalanced call.

Fixed by tracking whether there is an outstanding request, making the drop idempotent. The direct call in prepareForRecycle() is kept rather than removed, so we still drop correctly if a view is ever recycled while attached.

Testing

Not verified on device - CI builds cover compilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant