Open Bug 2014568 Opened 6 months ago Updated 1 month ago

Prevent duplicate Setting objects from being created

Categories

(Firefox :: Settings UI, defect, P3)

defect

Tracking

()

ASSIGNED

People

(Reporter: mstriemer, Assigned: mstriemer, NeedInfo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp])

Attachments

(1 file, 1 obsolete file)

In development we encountered a memory leak due to a Setting being registered multiple times (duplicate id). The Preferences.addSetting() method takes a SettingConfig and creates a Setting for it, but it does not perform any checks that this Setting hasn't been created already

Generally this doesn't cause any problems so it went unnoticed (likely the DOM node is connected to the first Setting and the additional Settings that get created just sit around without being accessed). However if the Setting has a setup() function, then we only call the teardown() for the last created Setting with that id. This causes a window leak if the setup() registers an observer.

It looks like we have a few places where we've accidentally registered the same id for multiple Settings. They all look benign and are likely consuming a little more memory than necessary, but they're simple wrappers for the same Preference object.

:scunnane - hi as a heads-up this bug has been moved to be post-MVP and since the blocker is fixed, we're working on the basis this isn't a blocker any more but shout if that's not the case.

Flags: needinfo?(scunnane)

Thanks for the head's up, Stuart. Not a blocker for any of the search settings work anymore - I landed a patch a while back that prevented creating extra Settings objects.

Flags: needinfo?(scunnane)
Attachment #9542505 - Attachment is obsolete: true

There is an r+ patch which didn't land and no activity in this bug for 1 week.
:mstriemer, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(mstriemer)
Flags: needinfo?(hjones)
Flags: needinfo?(hjones)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: