From 6447dcf7e0b7637bdaff9bef12695cd89da80e7e Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Wed, 9 Apr 2003 23:36:23 +0000 Subject: [PATCH] fix a crash if freetype is not present (bug 200720). r=alecf, sr=darin. git-svn-id: svn://10.0.0.236/trunk@140947 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp | 3 +++ mozilla/gfx/src/x11shared/nsFT2FontNode.cpp | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp b/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp index 1146b22e4ca..4d893662a4f 100644 --- a/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp +++ b/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp @@ -119,6 +119,9 @@ nsIPref* nsFT2FontCatalog::sPref = nsnull; NS_IMPL_ISUPPORTS1(nsFT2FontCatalog, nsIFontCatalogService) nsFT2FontCatalog::nsFT2FontCatalog() + : mFontCatalog(nsnull), + mRange1Language(nsnull), + mRange2Language(nsnull) { #if (defined(MOZ_ENABLE_FREETYPE2)) nsresult rv; diff --git a/mozilla/gfx/src/x11shared/nsFT2FontNode.cpp b/mozilla/gfx/src/x11shared/nsFT2FontNode.cpp index 93ad7751374..c3b68a5dd61 100644 --- a/mozilla/gfx/src/x11shared/nsFT2FontNode.cpp +++ b/mozilla/gfx/src/x11shared/nsFT2FontNode.cpp @@ -68,8 +68,7 @@ nsIFontCatalogService* nsFT2FontNode::sFcs = nsnull; void nsFT2FontNode::FreeGlobals() { - nsServiceManager::ReleaseService("@mozilla.org/gfx/xfontcatalogservice;1", - sFcs); + NS_IF_RELEASE(sFcs); if (mFreeTypeNodes) { mFreeTypeNodes->Reset(FreeNode, nsnull); @@ -87,10 +86,10 @@ nsFT2FontNode::InitGlobals() sInited = PR_TRUE; - nsServiceManager::GetService("@mozilla.org/gfx/xfontcatalogservice;1", - NS_GET_IID(nsIFontCatalogService), - (nsISupports**) &sFcs); - if (!sFcs) { + nsresult rv = ::CallGetService("@mozilla.org/gfx/xfontcatalogservice;1", + &sFcs); + + if (NS_FAILED(rv)) { NS_ERROR("Font Catalog Service init failed\n"); return NS_ERROR_FAILURE; }