Open Bug 1678364 Opened 5 years ago Updated 1 year ago

Automatically discard / cancel GeckoResults when view or session are destroyed

Categories

(GeckoView :: General, enhancement, P3)

Unspecified
All
enhancement

Tracking

(Not tracked)

People

(Reporter: csadilek, Unassigned)

Details

We've recently discovered a memory leak caused by indirectly referencing the activity context in the lambda passed to GeckoResult.then.

This is a very easy mistake to make and simply referencing this in most cases is enough to reference the context. Our concrete case was the capturePixels call on the GeckoView where the callback updated the bitmap of the tab.

We've worked around this by making sure we don't capture this and the context in the callback and use local variables everywhere inside the lambda, but it would be great if GeckoResults were automatically discarded if the corresponding view or session are destroyed.

Since we have GeckoResults on lots of different API calls, a generic solution would be ideal so the embedder doesn't have to worry about managing GeckoResults in response to lifecycle changes.

Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.