Closed Bug 1711246 Opened 3 years ago Closed 3 years ago

OSPreferences::GetInstanceAddRefed() is not safe to call off-main-thread

Categories

(Core :: Internationalization, defect)

defect

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(1 file)

The method gfxDWriteFontFamily::LocalizedName uses OSPreferences::GetInstanceAddRefed to get a reference to the preferences service; but LocalizedName may be called off-main-thread, which is bad because OSPreferences doesn't use thread-safe refcounting.

The bug can be demonstrated by running a debug Windows build with gfx.e10s.font-list.shared set to false, and then opening about:preferences. The thread that intends to populate the Font menu will crash with a thread-safety assertion.

In practice it seems highly unlikely this would cause problems, although maybe opening Preferences and then instantly shutting down the browser might possibly cause a race resulting in incorrect behavior (e.g. a leak or a double-free of the OSPreferences singleton). Nevertheless, we should fix it to avoid any risk.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/76dd6379cc01
Make OSPreferences refcounting thread-safe, because of potential OMT usage from gfxDWriteFontFamily. r=dminor
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: