Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed all setters to eliminate the possibility of accidentally releas…

…ing the value to be set in the case that [foo setValue:a] is called when [foo value] == a.
  • Loading branch information...
commit a5dcf946eec94be5eb8692a877caf61a3db92218 1 parent aba39e3
@andymatuschak andymatuschak authored
View
7 SUAppcast.m
@@ -70,8 +70,11 @@ - (void)reportError:(NSError *)error
- (void)setUserAgentString:(NSString *)uas
{
- [userAgentString release];
- userAgentString = [uas copy];
+ if (uas != userAgentString)
+ {
+ [userAgentString release];
+ userAgentString = [uas copy];
+ }
}
- (void)setDelegate:del
View
9 SUAppcastItem.m
@@ -17,6 +17,7 @@ - (NSString *)title { return [[title retain] autorelease]; }
- (void)setTitle:(NSString *)aTitle
{
+ if (title == aTitle) return;
[title release];
title = [aTitle copy];
}
@@ -26,6 +27,7 @@ - (NSDate *)date { return [[date retain] autorelease]; }
- (void)setDate:(NSDate *)aDate
{
+ if (date == aDate) return;
[date release];
date = [aDate copy];
}
@@ -35,6 +37,7 @@ - (NSString *)description { return [[description retain] autorelease]; }
- (void)setDescription:(NSString *)aDescription
{
+ if (description == aDescription) return;
[description release];
description = [aDescription copy];
}
@@ -44,6 +47,7 @@ - (NSURL *)releaseNotesURL { return [[releaseNotesURL retain] autorelease]; }
- (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL
{
+ if (releaseNotesURL == aReleaseNotesURL) return;
[releaseNotesURL release];
releaseNotesURL = [aReleaseNotesURL copy];
}
@@ -53,6 +57,7 @@ - (NSString *)DSASignature { return [[DSASignature retain] autorelease]; }
- (void)setDSASignature:(NSString *)aDSASignature
{
+ if (DSASignature == aDSASignature) return;
[DSASignature release];
DSASignature = [aDSASignature copy];
}
@@ -62,6 +67,7 @@ - (NSURL *)fileURL { return [[fileURL retain] autorelease]; }
- (void)setFileURL:(NSURL *)aFileURL
{
+ if (fileURL == aFileURL) return;
[fileURL release];
fileURL = [aFileURL copy];
}
@@ -71,6 +77,7 @@ - (NSString *)versionString { return [[versionString retain] autorelease]; }
- (void)setVersionString:(NSString *)s
{
+ if (versionString == s) return;
[versionString release];
versionString = [s copy];
}
@@ -80,6 +87,7 @@ - (NSString *)displayVersionString { return [[displayVersionString retain] autor
- (void)setDisplayVersionString:(NSString *)s
{
+ if (displayVersionString == s) return;
[displayVersionString release];
displayVersionString = [s copy];
}
@@ -88,6 +96,7 @@ - (void)setDisplayVersionString:(NSString *)s
- (NSString *)minimumSystemVersion { return [[minimumSystemVersion retain] autorelease]; }
- (void)setMinimumSystemVersion:(NSString *)systemVersionString
{
+ if (minimumSystemVersion == systemVersionString) return;
[minimumSystemVersion release];
minimumSystemVersion = [systemVersionString copy];
}
View
12 SUStatusController.m
@@ -61,7 +61,11 @@ - (void)beginActionWithTitle:(NSString *)aTitle maxProgressValue:(double)aMaxPro
- (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)setMaxProgressValue:(double)value
- (void)setStatusText:(NSString *)aStatusText
{
- statusText = [aStatusText copy];
+ if (statusText != aStatusText)
+ {
+ [statusText release];
+ statusText = [aStatusText copy];
+ }
}
@end
View
1  SUUpdater.m
@@ -223,6 +223,7 @@ - (void)setDelegate:aDelegate
- (void)setHostBundle:(NSBundle *)hb
{
+ if (hostBundle == hb) return;
[hostBundle release];
hostBundle = [hb retain];
[[SUUserDefaults standardUserDefaults] setIdentifier:[hostBundle bundleIdentifier]];
View
7 SUUserDefaults.m
@@ -27,8 +27,11 @@ - (void)dealloc
- (void)setIdentifier:(NSString *)anIdentifier
{
- [identifier autorelease];
- identifier = [anIdentifier copy];
+ if (identifier != anIdentifier)
+ {
+ [identifier release];
+ identifier = [anIdentifier copy];
+ }
}
- (void)verifyIdentifier
Please sign in to comment.
Something went wrong with that request. Please try again.