Diff for /chimera/nsCocoaBrowserService.mm between versions 1.3 and 1.4

version 1.3, 2002/02/04 07:25:16 version 1.4, 2002/02/05 01:17:11
Line 45 Line 45
 #include "nsCRT.h"  #include "nsCRT.h"
 #include "nsString.h"  #include "nsString.h"
   
 PRUint32 nsCocoaBrowserService::sNumBrowsers = 0;  
 nsAlertController* nsCocoaBrowserService::sController = nsnull;  nsAlertController* nsCocoaBrowserService::sController = nsnull;
 nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;  nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;
   
Line 57  nsCocoaBrowserService::nsCocoaBrowserSer Line 56  nsCocoaBrowserService::nsCocoaBrowserSer
   
 nsCocoaBrowserService::~nsCocoaBrowserService()  nsCocoaBrowserService::~nsCocoaBrowserService()
 {  {
   printf("Terminating embedding and shutting down.\n");  
   
   NS_TermEmbedding();  
 }  }
   
 NS_IMPL_ISUPPORTS3(nsCocoaBrowserService,  NS_IMPL_ISUPPORTS3(nsCocoaBrowserService,
Line 70  NS_IMPL_ISUPPORTS3(nsCocoaBrowserService Line 66  NS_IMPL_ISUPPORTS3(nsCocoaBrowserService
 nsresult  nsresult
 nsCocoaBrowserService::InitEmbedding()  nsCocoaBrowserService::InitEmbedding()
 {  {
  if (sSingleton) {  if (sSingleton)
    sNumBrowsers++; 
     return NS_OK;      return NS_OK;
   }  
   
   // XXX Temporary hack to make sure we find the     // XXX Temporary hack to make sure we find the 
   // right executable directory    // right executable directory
Line 89  nsCocoaBrowserService::InitEmbedding() Line 83  nsCocoaBrowserService::InitEmbedding()
     return NS_ERROR_OUT_OF_MEMORY;      return NS_ERROR_OUT_OF_MEMORY;
   }    }
   NS_ADDREF(sSingleton);    NS_ADDREF(sSingleton);
  sNumBrowsers = 1;  
 
   nsresult rv = NS_InitEmbedding(nsnull, nsnull);    nsresult rv = NS_InitEmbedding(nsnull, nsnull);
   if (NS_FAILED(rv)) {    if (NS_FAILED(rv)) {
     return rv;      return rv;
Line 146  nsCocoaBrowserService::InitEmbedding() Line 139  nsCocoaBrowserService::InitEmbedding()
 void  void
 nsCocoaBrowserService::TermEmbedding()  nsCocoaBrowserService::TermEmbedding()
 {  {
   // XXXdwh This is leaking because our refcount isn't just 1.  Probably XPCOM  
   // holding the service (e.g., the service manager).  
   if (--sNumBrowsers == 0) {  
     NS_RELEASE(sSingleton);      NS_RELEASE(sSingleton);
  }    printf("Terminating embedding and shutting down.\n");
     NS_TermEmbedding();
 }  }
   
 #define NS_ALERT_NIB_NAME "alert"  #define NS_ALERT_NIB_NAME "alert"

Removed from v.1.3  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>