if (nsFontMetricsWin::gGlobalFonts) {  for (int i = 0; i < nsFontMetricsWin::gGlobalFontsCount; i++) { delete nsFontMetricsWin::gGlobalFonts[i].name; } PR_Free(nsFontMetricsWin::gGlobalFonts); nsFontMetricsWin::gGlobalFonts = nsnull; gGlobalFontsAlloc = 0; nsFontMetricsWin::gGlobalFontsCount = 0; }
FreeGlobals(void){  // XXX complete this  gInitialized = 0;  NS_IF_RELEASE(gFontEncodingProperties);  NS_IF_RELEASE(gCharSetManager);  NS_IF_RELEASE(gPref);  NS_IF_RELEASE(gUserDefined);  NS_IF_RELEASE(gUserDefinedConverter);  NS_IF_RELEASE(gJA);  NS_IF_RELEASE(gKO);  NS_IF_RELEASE(gZHTW);  NS_IF_RELEASE(gZHCN);  // free CMap  if (nsFontMetricsWin::gFontMaps) {    PL_HashTableDestroy(nsFontMetricsWin::gFontMaps);    if (nsFontMetricsWin::gEmptyMap) {      PR_Free(nsFontMetricsWin::gEmptyMap);      nsFontMetricsWin::gEmptyMap = nsnull;    }    nsFontMetricsWin::gFontMaps = nsnull;    gInitializedFontMaps = 0;    if (nsFontMetricsWin::gGlobalFonts) {        //while all cmap is freed, gGlobalFonts's pointer should be freed too.      for (int i = 0; i < nsFontMetricsWin::gGlobalFontsCount; i++) {         delete nsFontMetricsWin::gGlobalFonts[i].name;      }      PR_Free(nsFontMetricsWin::gGlobalFonts);      nsFontMetricsWin::gGlobalFonts = nsnull;      gGlobalFontsAlloc = 0;      nsFontMetricsWin::gGlobalFontsCount = 0;    }  }  // free FamilyNames  if (nsFontMetricsWin::gFamilyNames) {    PL_HashTableDestroy(nsFontMetricsWin::gFamilyNames);    nsFontMetricsWin::gFamilyNames = nsnull;    gInitializedFamilyNames = 0;  }  // free Font weight  if (nsFontMetricsWin::gFontWeights) {    PL_HashTableDestroy(nsFontMetricsWin::gFontWeights);    nsFontMetricsWin::gFontWeights = nsnull;    gInitializedFontWeights = 0;  }}