Re:NSToolbar messing with strings?[SOLVED]
Re:NSToolbar messing with strings?[SOLVED]
- Subject: Re:NSToolbar messing with strings?[SOLVED]
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 29 Jul 2002 21:21:30 +0100
Thanks to those who replied. The suggestions were, naturally, correct.
SOLUTIONS:
1. I declared #import "ToolbarDelegateCategory.h" in my controller
source file. (I had been under the impression that this wasn't necessary
with a category.)
2. The problem with the strings wasn't to do with forgetting retains
(well, not exactly...), but due to using a stupid setter method. I was
using:
- (void)setDateFormatSetting:(NSString *)date
timeFormatSetting:(NSString *)time
{
dateFormat = date;
timeFormat = time;
}
I've replaced it with:
- (void)setDateFormatSetting:(NSString *)date
timeFormatSetting:(NSString *)time
{
[dateFormat autorelease];
dateFormat = [date copy];
[timeFormat autorelease];
timeFormat = [time copy];
}
With hindsight, what's surprising is that the first method worked at
all, even if erratically. Although I have heard that inadequately
disciplined strings can behave extremely oddly once they're let loose in
memory space.
-Jeremy
=======================================
email@hidden //@macunlimited.net
The Alchemy Pages:
http://freespace.virgin.net/jeremy.dronfield
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.