Fix some refcounting issues seen when building on 10.4.

This commit is contained in:
smfr%smfr.org 2005-09-08 01:50:00 +00:00
Родитель feda7dceed
Коммит a62fda3ba1
5 изменённых файлов: 18 добавлений и 24 удалений

Просмотреть файл

@ -123,7 +123,7 @@ NS_IMETHODIMP SecurityDialogs::ConfirmDownloadCACert(nsIInterfaceRequestor *ctx,
docLocation->GetHref(location);
#endif
DownloadCACertDialogController* downloadCertDialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] downloadCACertDialogController];
DownloadCACertDialogController* downloadCertDialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] downloadCACertDialogController] retain];
if (!downloadCertDialogController)
return NS_ERROR_FAILURE;
@ -145,6 +145,7 @@ NS_IMETHODIMP SecurityDialogs::ConfirmDownloadCACert(nsIInterfaceRequestor *ctx,
else
*_retval = PR_FALSE;
[downloadCertDialogController release];
return NS_OK;
}
@ -189,7 +190,7 @@ NS_IMETHODIMP SecurityDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
password.Truncate();
CreatePasswordDialogController* pwDialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] createPasswordDialogController];
CreatePasswordDialogController* pwDialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] createPasswordDialogController] retain];
if (!pwDialogController)
return NS_ERROR_FAILURE;
@ -216,6 +217,7 @@ NS_IMETHODIMP SecurityDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
if (confirmed)
[thePassword assignTo_nsAString:password];
[pwDialogController release];
return NS_OK;
}
@ -351,7 +353,7 @@ SecurityDialogs::ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo,
*_retval = PR_FALSE;
*outAddType = UNINIT_ADD_FLAG;
UnknownCertIssuerDialogController* dialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] unknownCertIssuerDialogController];
UnknownCertIssuerDialogController* dialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] unknownCertIssuerDialogController] retain];
if (!dialogController)
return NS_ERROR_FAILURE;
@ -387,6 +389,7 @@ SecurityDialogs::ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo,
break;
}
[dialogController release];
return NS_OK;
}
@ -415,7 +418,7 @@ SecurityDialogs::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo,
// testing
ConfirmKeyEscrow(cert, _retval);
MismatchedCertDomainDialogController* certDialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] mismatchedCertDomainDialogController];
MismatchedCertDomainDialogController* certDialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] mismatchedCertDomainDialogController] retain];
if (!certDialogController)
return NS_ERROR_FAILURE;
@ -432,6 +435,7 @@ SecurityDialogs::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo,
*_retval = (result == NSAlertDefaultReturn);
[certDialogController release];
return NS_OK;
}
@ -454,7 +458,7 @@ NS_IMETHODIMP
SecurityDialogs::ConfirmCertExpired(nsIInterfaceRequestor *socketInfo,
nsIX509Cert *cert, PRBool *_retval)
{
ExpiredCertDialogController* expiredCertController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] expiredCertDialogController];
ExpiredCertDialogController* expiredCertController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] expiredCertDialogController] retain];
if (!expiredCertController)
return NS_ERROR_FAILURE;
@ -468,6 +472,7 @@ SecurityDialogs::ConfirmCertExpired(nsIInterfaceRequestor *socketInfo,
result = [NSApp runModalForWindow:[expiredCertController window]];
*_retval = (result == NSAlertDefaultReturn);
[expiredCertController release];
return NS_OK;
}
@ -626,7 +631,7 @@ SecurityDialogs::SetPassword(nsIInterfaceRequestor *ctx, const PRUnichar *tokenN
tokenNameString];
}
CreatePasswordDialogController* pwDialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] createPasswordDialogController];
CreatePasswordDialogController* pwDialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] createPasswordDialogController] retain];
if (!pwDialogController)
return NS_ERROR_FAILURE;
@ -668,6 +673,7 @@ SecurityDialogs::SetPassword(nsIInterfaceRequestor *ctx, const PRUnichar *tokenN
else
rv = theToken->ChangePassword(oldPassword.get(), newPassword.get());
[pwDialogController release];
return rv;
}
@ -760,9 +766,7 @@ SecurityDialogs::ChooseCertificate(nsIInterfaceRequestor *ctx, const PRUnichar *
return NS_ERROR_FAILURE;
}
ChooseCertDialogController* dialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] chooseCertDialogController];
[dialogController retain];
ChooseCertDialogController* dialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] chooseCertDialogController] retain];
[dialogController setCommonName:[NSString stringWithPRUnichars:cn]
organization:[NSString stringWithPRUnichars:organization]
issuer:[NSString stringWithPRUnichars:issuer]];
@ -860,7 +864,7 @@ SecurityDialogs::DisplayGeneratingKeypairInfo(nsIInterfaceRequestor *ctx, nsIKey
// the thread is complete. Not sure if it goes away or not.
nsCOMPtr<nsIKeygenThread> threadDeathGrip = runnable;
GenKeyPairDialogController* dialogController = [[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] genKeyPairDialogController];
GenKeyPairDialogController* dialogController = [[[BrowserSecurityUIProvider sharedBrowserSecurityUIProvider] genKeyPairDialogController] retain];
if (!dialogController)
return NS_ERROR_FAILURE;
@ -877,6 +881,7 @@ SecurityDialogs::DisplayGeneratingKeypairInfo(nsIInterfaceRequestor *ctx, nsIKey
return NS_ERROR_FAILURE;
}
[dialogController release];
return NS_OK;
}

Просмотреть файл

@ -55,8 +55,7 @@ class nsIX509Cert;
+ (BrowserSecurityUIProvider*)sharedBrowserSecurityUIProvider;
+ (NSImage*)lockBadgedApplicationIcon;
// these dialog controllers are autoreleased. If you want to run one non-modally,
// you'll need to retain it.
// these dialog controllers are autoreleased. You should retain them while running the dialog.
- (DownloadCACertDialogController*)downloadCACertDialogController;
- (MismatchedCertDomainDialogController*)mismatchedCertDomainDialogController;
- (UnknownCertIssuerDialogController*)unknownCertIssuerDialogController;

Просмотреть файл

@ -735,8 +735,6 @@ NSString* const CertificateChangedNotificationName = @"CertificateChangedNotific
mASN1InfoDict = [[self traverseSequence:objectAsSequence] retain];
else
mASN1InfoDict = [[NSDictionary alloc] init]; // avoid multiple lookups
NSLog(@"Info dict: %@", mASN1InfoDict);
}
}
@ -777,7 +775,6 @@ NSString* const CertificateChangedNotificationName = @"CertificateChangedNotific
CertificateItem* changedCert = [inNotification object];
if ([self certificateIsInParentChain:changedCert]) // actually includes 'self', but that's OK
{
NSLog(@"updating cert %@ because parent changed", self);
mGotVerification = NO;
PRUint32 oldValidity = mVerification;
if (oldValidity != [self generalValidity])

Просмотреть файл

@ -122,7 +122,6 @@ const float kGapUnderLine = 5.0f;
- (float)rebuildTrustSettings:(float)inOffset;
- (BOOL)showTrustSettings;
- (void)hexBlockExpandButtonClicked:(id)sender;
- (void)certificateChanged:(NSNotification*)inNotification;
@end
@ -695,17 +694,11 @@ const float kGapUnderLine = 5.0f;
[self setFrameSize:curSize];
}
- (void)hexBlockExpandButtonClicked:(id)sender
{
NSLog(@"sender: %@", sender);
}
- (void)certificateChanged:(NSNotification*)inNotification
{
CertificateItem* changedCert = [inNotification object];
if ([mCertItem isEqualTo:changedCert])
{
NSLog(@"refreshing view");
[self refreshView];
}
}

Просмотреть файл

@ -516,7 +516,7 @@ static CertificatesWindowController* gCertificatesWindowController;
NSString* cancelButton = NSLocalizedStringFromTable(@"CancelButtonTitle", @"CertificateDialogs", @"");
#warning fix for plurals
NSString* title = @"fix me"; // [NSString stringWithFormat:titleFormat, [selectedCert displayName]];
NSString* title = [NSString stringWithFormat:titleFormat, [[selectedCerts objectAtIndex:0] displayName]];
NSBeginAlertSheet(title,
deleteButton,
@ -852,7 +852,7 @@ static CertificatesWindowController* gCertificatesWindowController;
PRUint32 numCerts = [certsToSave count];
nsIX509Cert** certList = new (nsIX509Cert*)[numCerts];
nsIX509Cert** certList = new nsIX509Cert*[numCerts];
for (PRUint32 i = 0; i < numCerts; i ++)
certList[i] = [[certsToSave objectAtIndex:i] cert];