NS_RELEASE(gNameSpaceManager); NS_IF_RELEASE(gHTMLElementFactory); NS_IF_RELEASE(gXMLElementFactory);  if (gXULUtils) { nsServiceManager::ReleaseService(kXULContentUtilsCID, gXULUtils); gXULUtils = nsnull; }  nsXULAtoms::Release();
nsXULTemplateBuilder::~nsXULTemplateBuilder(void){    // NS_IF_RELEASE(mDocument) not refcounted    --gRefCnt;    if (gRefCnt == 0) {        NS_IF_RELEASE(kNC_Title);        NS_IF_RELEASE(kNC_child);        NS_IF_RELEASE(kNC_Column);        NS_IF_RELEASE(kNC_Folder);        NS_IF_RELEASE(kRDF_instanceOf);        NS_IF_RELEASE(kXUL_element);        if (gRDFService) {            nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);            gRDFService = nsnull;        }        if (gRDFContainerUtils) {            nsServiceManager::ReleaseService(kRDFContainerUtilsCID, gRDFContainerUtils);            gRDFContainerUtils = nsnull;        }        if (gXULSortService) {            nsServiceManager::ReleaseService(kXULSortServiceCID, gXULSortService);            gXULSortService = nsnull;        }        NS_RELEASE(gNameSpaceManager);        NS_IF_RELEASE(gHTMLElementFactory);        NS_IF_RELEASE(gXMLElementFactory);        if (gXULUtils) {            nsServiceManager::ReleaseService(kXULContentUtilsCID, gXULUtils);            gXULUtils = nsnull;        }        nsXULAtoms::Release();    }}