Fixed all setters to eliminate the possibility of accidentally releasing the value to be set in the case that [foo setValue:a] is called when [foo value] == a.

This commit is contained in:
Andy Matuschak committed 2008-06-20 22:31:07 -07:00
1 parent aba39e3429
commit a5dcf946ee
5 files changed
+30 -6

No files matched your search

+5 -2
View File
@@ -70,8 +70,11 @@
- (void)setUserAgentString:(NSString *)uas
{
[userAgentString release];
userAgentString = [uas copy];
if (uas != userAgentString)
{
[userAgentString release];
userAgentString = [uas copy];
}
}
- (void)setDelegate:del
+9
View File
@@ -17,6 +17,7 @@
- (void)setTitle:(NSString *)aTitle
{
if (title == aTitle) return;
[title release];
title = [aTitle copy];
}
@@ -26,6 +27,7 @@
- (void)setDate:(NSDate *)aDate
{
if (date == aDate) return;
[date release];
date = [aDate copy];
}
@@ -35,6 +37,7 @@
- (void)setDescription:(NSString *)aDescription
{
if (description == aDescription) return;
[description release];
description = [aDescription copy];
}
@@ -44,6 +47,7 @@
- (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL
{
if (releaseNotesURL == aReleaseNotesURL) return;
[releaseNotesURL release];
releaseNotesURL = [aReleaseNotesURL copy];
}
@@ -53,6 +57,7 @@
- (void)setDSASignature:(NSString *)aDSASignature
{
if (DSASignature == aDSASignature) return;
[DSASignature release];
DSASignature = [aDSASignature copy];
}
@@ -62,6 +67,7 @@
- (void)setFileURL:(NSURL *)aFileURL
{
if (fileURL == aFileURL) return;
[fileURL release];
fileURL = [aFileURL copy];
}
@@ -71,6 +77,7 @@
- (void)setVersionString:(NSString *)s
{
if (versionString == s) return;
[versionString release];
versionString = [s copy];
}
@@ -80,6 +87,7 @@
- (void)setDisplayVersionString:(NSString *)s
{
if (displayVersionString == s) return;
[displayVersionString release];
displayVersionString = [s copy];
}
@@ -88,6 +96,7 @@
- (NSString *)minimumSystemVersion { return [[minimumSystemVersion retain] autorelease]; }
- (void)setMinimumSystemVersion:(NSString *)systemVersionString
{
if (minimumSystemVersion == systemVersionString) return;
[minimumSystemVersion release];
minimumSystemVersion = [systemVersionString copy];
}
+10 -2
View File
@@ -61,7 +61,11 @@
- (void)setButtonTitle:(NSString *)aButtonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault
{
[self willChangeValueForKey:@"buttonTitle"];
buttonTitle = [aButtonTitle copy];
if (buttonTitle != aButtonTitle)
{
[buttonTitle release];
buttonTitle = [aButtonTitle copy];
}
[self didChangeValueForKey:@"buttonTitle"];
[self window];
@@ -113,7 +117,11 @@
- (void)setStatusText:(NSString *)aStatusText
{
statusText = [aStatusText copy];
if (statusText != aStatusText)
{
[statusText release];
statusText = [aStatusText copy];
}
}
@end
+1
View File
@@ -223,6 +223,7 @@ static SUUpdater *sharedUpdater = nil;
- (void)setHostBundle:(NSBundle *)hb
{
if (hostBundle == hb) return;
[hostBundle release];
hostBundle = [hb retain];
[[SUUserDefaults standardUserDefaults] setIdentifier:[hostBundle bundleIdentifier]];
+5 -2
View File
@@ -27,8 +27,11 @@
- (void)setIdentifier:(NSString *)anIdentifier
{
[identifier autorelease];
identifier = [anIdentifier copy];
if (identifier != anIdentifier)
{
[identifier release];
identifier = [anIdentifier copy];
}
}
- (void)verifyIdentifier