-autorelease goes *after* -init

This commit is contained in:
Nate Weaver 2012-07-04 23:41:43 -05:00
parent c702faaaf2
commit 76281dd506
3 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
+ (id)elementForType:(NSString *)t withLabel:(NSString *)l
{
return [[[self alloc] autorelease] initForType:t withLabel:l];
return [[[self alloc]initForType:t withLabel:l] autorelease];
}
- (id)initForType:(NSString *)t withLabel:(NSString *)l

View File

@ -27,12 +27,12 @@
+ (id)streamWithBytes:(char *)d length:(unsigned int)l
{
return [[[self alloc] autorelease] initStreamWithBytes:d length:l];
return [[[self alloc] initStreamWithBytes:d length:l] autorelease];
}
+ (id)substreamWithStream:(TemplateStream *)s length:(unsigned int)l
{
return [[[self alloc] autorelease] initWithStream:s length:l];
return [[[self alloc] initWithStream:s length:l] autorelease];
}
- (id)initStreamWithBytes:(char *)d length:(unsigned int)l

View File

@ -102,7 +102,7 @@
{
if(!liveEdit)
// bug: should display alert asking if you want to replace data in this editor or reassert this data, revoking the other editor's changes
[resource setData:[[backup data] copy]];
[resource setData:[[[backup data] copy] autorelease]];
[self loadResource];
}
@ -204,14 +204,14 @@
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:ResourceDataDidChangeNotification object:resource];
[resource setData:newData];
[backup setData:[newData copy]];
[backup setData:[[newData copy] autorelease]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
}
else
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:ResourceDataDidChangeNotification object:backup];
[resource setData:newData];
[backup setData:[newData copy]];
[backup setData:[[newData copy] autorelease]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:backup];
[self setDocumentEdited:NO];
}