mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 22:29:13 +00:00
When a BackgroundAction completes, it resolves a Promise (stored on the BackgroundAction object) with a reference to itself. The Promise will never unset this resolved value, thus it will hold a strong reference to the BackgroundAction until it is destroyed. But because the Promise is owned by the BackgroundAction itself, we have a reference cycle, and neither object can be destroyed. The only user of BackgroundAction is the ImageDecoder process. The consequence was that the ImageDecoder process would never release any image data for successfully decoded images. To fix this, instead of storing the promise on the class itself, we can just create it as a local variable and pass it around.