diff options
Diffstat (limited to 'gfx/thebes/gfxFT2FontList.cpp')
-rw-r--r-- | gfx/thebes/gfxFT2FontList.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 8a652df0dd..09c938a248 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -812,6 +812,15 @@ public: : mFontList(aFontList) { } + void Remove() + { + nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); + if (obs) { + obs->RemoveObserver(this, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID); + } + mFontList = nullptr; + } + protected: virtual ~WillShutdownObserver() { } @@ -847,11 +856,7 @@ gfxFT2FontList::gfxFT2FontList() gfxFT2FontList::~gfxFT2FontList() { if (mObserver) { - nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); - if (obs) { - obs->RemoveObserver(mObserver, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID); - } - mObserver = nullptr; + mObserver->Remove(); } } |