Closed Bug 1682045 Opened 3 years ago Closed 3 years ago

OneShotPostRefreshObserver can possibly leak and also leak presShell

Categories

(Core :: Layout, defect)

defect

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: sefeng, Assigned: sefeng)

Details

Attachments

(1 file)

We added it as a raw pointer to the observer array here https://searchfox.org/mozilla-central/rev/0bcf81557b89e7757c44e25bb4bc7f4cb8619dc9/dom/base/nsDOMWindowUtils.cpp#2791 and https://searchfox.org/mozilla-central/source/layout/xul/nsSliderFrame.cpp#994, and this object will only delete itself if DidRefresh is called which is bad. If it leaks, it'll also leak presShell.

I'll submit a patch to fix it.

OneShotPostRefreshObserver works as the caller registers it, and
let it deletes itself via the DidRefresh method. The issue is that
DidRefresh is not guaranteed to run, and it'll leak PresShell
if it doesn't run.

This patch allows nsPresContext to store and release the last
registered OneShotPostRefreshObserver, and converted the existing
usage of OneShotPostRefreshObserver to use that. So instead of asking
OneShotPostRefreshObserver to delete itself, we now ask nsPresContext
to release it.

Severity: -- → S3
Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a0cde344a949
Allow nsPresContext to store and release the last registered OneShotPostRefreshObserver r=smaug
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: