Closed Bug 1685221 Opened 3 years ago Closed 3 years ago

Eliminate C++ static initializers in nsTouchBar.mm

Categories

(Core :: Widget: Cocoa, defect)

All
macOS
defect

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(2 files)

nsTouchBar.mm uses C++ static initializers to initialize the global variables ShareScrubberIdentifier and SearchPopoverIdentifier: https://searchfox.org/mozilla-central/rev/a0ccd492719b1ad2106f6456549be62a76f45acb/widget/cocoa/nsTouchBar.mm#19-28

Static initializers are worth avoiding in general (I forgot the exact reasoning, but it was something about influencing the read order of the XUL library from disk in a bad way).
However, they're extra worth avoiding if they run code that autoreleases ObjC objects, because no autorelease pool is in place when they run, so any temporary autoreleased objects are leaked. The autoreleases also cause warnings when running with OBJC_DEBUG_MISSING_POOLS=YES LIBDISPATCH_DEBUG_MISSING_POOLS=NO.

Summary: C++ static initializers in nsTouchBar.mm → Eliminate C++ static initializers in nsTouchBar.mm
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/2aa6b9779822
Remove C++ static initializers for touch bar identifiers. r=spohl
https://hg.mozilla.org/integration/autoland/rev/1cba84787974
Add some missing includes to fix non-unified builds. r=spohl
Status: ASSIGNED → 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: