From 42fef2fc71c8ea7bd173d583294bedb34ca9f83d Mon Sep 17 00:00:00 2001 From: "alqahira%ardisson.org" Date: Mon, 25 Aug 2008 17:36:02 +0000 Subject: [PATCH] Bug 410731 - Crash [@ nssTrustDomain_LockCertCache] when quitting Camino with the 'Certificates' window open. Patch by Doug Turner , r=smorgan, sr=pink, a/Cm1.6.4=me git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@253813 18797224-902f-48f8-a5cc-f745e15eee43 --- .../security/CertificatesWindowController.h | 4 --- .../security/CertificatesWindowController.mm | 34 ++++++++----------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/mozilla/camino/src/security/CertificatesWindowController.h b/mozilla/camino/src/security/CertificatesWindowController.h index a25a7beeebe..d513d801a85 100644 --- a/mozilla/camino/src/security/CertificatesWindowController.h +++ b/mozilla/camino/src/security/CertificatesWindowController.h @@ -39,8 +39,6 @@ #import -class CertDataOwner; - @class ExtendedSplitView; @class ExtendedOutlineView; @@ -58,8 +56,6 @@ class CertDataOwner; NSArray* mCertificatesData; NSString* mDetailsColumnKey; - - CertDataOwner* mDataOwner; // container for C++ stuff } + (CertificatesWindowController*)sharedCertificatesWindowController; diff --git a/mozilla/camino/src/security/CertificatesWindowController.mm b/mozilla/camino/src/security/CertificatesWindowController.mm index 6e8ce6bf78d..e0fddc58acf 100644 --- a/mozilla/camino/src/security/CertificatesWindowController.mm +++ b/mozilla/camino/src/security/CertificatesWindowController.mm @@ -61,20 +61,6 @@ #import "ViewCertificateDialogController.h" #import "CertificatesWindowController.h" -// C++ class that holds owning refs to XPCOM interfaces for the window controller -class CertDataOwner -{ -public: - - CertDataOwner() - { - mCertCache = do_CreateInstance("@mozilla.org/security/nsscertcache;1"); - mCertCache->CacheAllCerts(); - } - - nsCOMPtr mCertCache; -}; - #pragma mark - @interface CertificatesWindowController(Private) @@ -420,7 +406,6 @@ static CertificatesWindowController* gCertificatesWindowController; [mCertificatesData release]; [mDetailsColumnKey release]; - delete mDataOwner; [super dealloc]; } @@ -581,9 +566,6 @@ static CertificatesWindowController* gCertificatesWindowController; if (curSelectedRow == -1) curSelectedRow = 0; - delete mDataOwner; - mDataOwner = new CertDataOwner; - [self setupCertsData]; [mCategoriesTable reloadData]; @@ -697,8 +679,20 @@ static CertificatesWindowController* gCertificatesWindowController; { rowDict = [mCertificatesData objectAtIndex:rowIndex]; CertificatesDataSource* certsDataSource = [rowDict objectForKey:@"data_source"]; - [certsDataSource ensureCertsLoaded:mDataOwner->mCertCache.get()]; - [mCertsOutlineView setDataSource:certsDataSource]; + nsCOMPtr certCache = do_CreateInstance("@mozilla.org/security/nsscertcache;1"); + + // If we can't access the cert cache (for example during app shutdown), + // let's just clear the view, and move on. + if (certCache) + { + certCache->CacheAllCerts(); + [certsDataSource ensureCertsLoaded:certCache]; + [mCertsOutlineView setDataSource:certsDataSource]; + } + else + { + [mCertsOutlineView setDataSource:nil]; + } } else {