FROM : Michael Becker
DATE : Fri Nov 05 17:46:48 2004
Hello all!
I have a subclass of NSCell (for a TableView) that is supposed to
display an image and an NSPopUpButtonCell. Everything works fine so
far, but I obviously need to override -copyWithZone:. Here's what I
came up with:
- (id)copyWithZone:(NSZone *)zone {
PCShoppingCartCell *copy = [[ PCShoppingCartCell alloc]
initImageCell:nil];
return copy;
}
This does not crash, but it looks so suspiciously memory-leaking...
(the alloc/init is not paired with a release on my side). When trying
to follow the (few) suggestions the docs give me, I tried this (but it
did not work, the app crashed as soon as the TableView wanted to
redraw):
- (id)copyWithZone:(NSZone *)zone
{
PCShoppingCartCell *copy = [super copyWithZone:zone];
[ copy _initSubCells]; // This inits and sets up the NSPopUpButtonCell
return copy;
}
Can anybody give me advice on how I do this the right way?
Kind regards,
Michael
DATE : Fri Nov 05 17:46:48 2004
Hello all!
I have a subclass of NSCell (for a TableView) that is supposed to
display an image and an NSPopUpButtonCell. Everything works fine so
far, but I obviously need to override -copyWithZone:. Here's what I
came up with:
- (id)copyWithZone:(NSZone *)zone {
PCShoppingCartCell *copy = [[ PCShoppingCartCell alloc]
initImageCell:nil];
return copy;
}
This does not crash, but it looks so suspiciously memory-leaking...
(the alloc/init is not paired with a release on my side). When trying
to follow the (few) suggestions the docs give me, I tried this (but it
did not work, the app crashed as soon as the TableView wanted to
redraw):
- (id)copyWithZone:(NSZone *)zone
{
PCShoppingCartCell *copy = [super copyWithZone:zone];
[ copy _initSubCells]; // This inits and sets up the NSPopUpButtonCell
return copy;
}
Can anybody give me advice on how I do this the right way?
Kind regards,
Michael






Cocoa mail archive

