Bug 1396453 - (speculative fix) - Remove the registered-fonts-changed notification observer when shutting down Mac font list, to avoid any risk of being called later during shutdown. r=jrmuizel
authorJonathan Kew <jkew@mozilla.com>
Tue, 05 Sep 2017 20:45:26 +0100
changeset 428606 264087371af5dcbd4c0221ce716f3e01ce66ea9c
parent 428605 dadf26985c95d88cb187a26ec619a4898089a0c4
child 428607 d0bd5ff0d46f999b41fe8eff351d36c042a54a6f
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1396453
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1396453 - (speculative fix) - Remove the registered-fonts-changed notification observer when shutting down Mac font list, to avoid any risk of being called later during shutdown. r=jrmuizel
gfx/thebes/gfxMacPlatformFontList.mm
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -752,16 +752,21 @@ gfxMacPlatformFontList::gfxMacPlatformFo
 
     // cache this in a static variable so that MacOSFontFamily objects
     // don't have to repeatedly look it up
     sFontManager = [NSFontManager sharedFontManager];
 }
 
 gfxMacPlatformFontList::~gfxMacPlatformFontList()
 {
+    ::CFNotificationCenterRemoveObserver(::CFNotificationCenterGetLocalCenter(),
+                                         this,
+                                         kCTFontManagerRegisteredFontsChangedNotification,
+                                         0);
+
     if (mDefaultFont) {
         ::CFRelease(mDefaultFont);
     }
 }
 
 void
 gfxMacPlatformFontList::AddFamily(const nsAString& aFamilyName,
                                   bool aSystemFont)