if (--gRefCnt == 0) {  PRInt32 count = mWindowList.Count(); for ( int32 i = 0; i< count; i++ ) { nsWindowInfo* windowInfo = ( nsWindowInfo*) mWindowList[i]; UnregisterWindow ( (windowInfo )->mWindow ); }   gRDFService->UnregisterDataSource(this); nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService); gRDFService = nsnull;  NS_RELEASE(kNC_WindowMediatorRoot); NS_RELEASE( kNC_Name ); NS_RELEASE(kNC_URL); NS_RELEASE(mInner); }
if (--gRefCnt == 0) {   while (mOldestWindow) UnregisterWindow(mOldestWindow);  if (mListLock) PR_DestroyLock(mListLock); }
nsWindowMediator::~nsWindowMediator(){    if (--gRefCnt == 0)    {    	// Delete data   		PRInt32 count = mWindowList.Count();			for ( int32 i = 0; i< count; i++ )			{				nsWindowInfo* windowInfo = ( nsWindowInfo*) mWindowList[i];				UnregisterWindow ( (windowInfo )->mWindow );			}				// unregister this from the RDF service			gRDFService->UnregisterDataSource(this);			nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);			gRDFService = nsnull;		      NS_RELEASE(kNC_WindowMediatorRoot);      NS_RELEASE( kNC_Name );      NS_RELEASE(kNC_URL);      NS_RELEASE(mInner);    }}