Closed Bug 1702823 Opened 3 years ago Closed 3 years ago

Remove the reference of the function when the listener gets disconnected

Categories

(Core :: Audio/Video: Playback, task, P3)

task

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

Details

Attachments

(1 file)

The problem was discovered in this revision [1] where the listener was still holding the callback function that owns a strong reference to another object. As the reference of that object is still alive even if the listener had explicitly called Disconnect(), that causes a reference loop and a memory leak.

[1] https://phabricator.services.mozilla.com/D106040

The callback function itself might contains a strong reference to other object, and that reference should be clear as well when the listener explicity gets revoked, which means we won't trigger the function anymore.

If the reference doen't be clear, then it's possible to cause a memory leak if the reference eventually becomes a cycle.

Blocks: 1695265
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/081233f6b52e
Clear callback function after listener gets revoked. r=bryce
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: