Thanks guys, its starting to become a bit clearer now. I'll use the alloc / init / release route for now until I"ve read through the memory management doc

Cheers,

Memo.


On 27 Aug 2008, at 12:22, Jonathan del Strother wrote:

On Wed, Aug 27, 2008 at 12:13 PM, Memo Akten <[EMAIL PROTECTED]> wrote:
ok thanks, I"ve added that link to my ever growing Cocoa bookmarks!!
I'm just writing a Quartz Composer plugin using the QCPlugIn API and ran into a problem regarding this, my question isn't related to the QCPlugIn API
so I'm posting here first.
At the start of the plugin (in enableExecution) I use the code:
- (void) loadCardXMLData {
NSString *dataPath = @"/data.plist";
cardsLoadedData = [NSDictionary dictionaryWithContentsOfFile: dataPath];
// cardsLoadedData = [[NSDictionary alloc] initWithContentsOfFile:
dataPath];
if(cardsLoadedData) {
NSLog(@"*** SUCCESSFULLY LOADED %@", dataPath);
} else {
NSLog(@"*** COULD NOT LOAD %@", dataPath);
}
}
If I use the convenience route (with no release in disableExecution) I get a freeze (I need to force quit QC) as soon as I enable the plugin. If I use the alloc route (and release in disableExecution) everything works fine. Is
this normal behaviour? or could it be QC related?
P.S. cardsLoadedData is a property of my QCPlugIn class, and I don't use it
at all except at the end of execute I just send it out to QC
with self.outputXMLData = cardsLoadedData;
Cheers,
Memo.



You're assigning an autoreleased object to your cardsLoadedData ivar.
Next time the autorelease pool pops, your dictionary is going to get
released.  Either retain the dictionary, or use alloc+init, or
(preferably) use self.cardsLoadedData= instead of just
cardsLoadedData=, which will assign via the property method, which
will retain for you (assuming you've set up the property correctly).

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to