NSSegmentedControl seems to leak with the copy protocol
NSSegmentedControl seems to leak with the copy protocol
- Subject: NSSegmentedControl seems to leak with the copy protocol
- From: David Hoerl <email@hidden>
- Date: Tue, 09 Aug 2005 12:49:07 -0400
I have constructed a NSSegmentedControl in IB, that I have reason to
duplicate programmatically. I am using a technique for many other
controls that works fine, but NSSegmentedControl leaks
NSSegmentedItems when I use it with this NSSegmentedControls. The
technique is to create a new control, create a duplicate of the model
control's cell, then set it into the new control.
Again, this works fine (and has no leaks) for other controls
(Buttons, popups etc.) Should this work with a segmented control too
(ie is it a bug)?
The code snippet:
// model control
foo = [[NSSegmentedControl alloc] initWithFrame:NSMakeRect(0,0,100,16) ];
[foo setSegmentCount:2];
[foo setLabel:@"A" forSegment:0];
[foo setLabel:@"B" forSegment:1];
for(i=0; i<1000; ++i) {
newFoo = [[NSSegmentedControl alloc] initWithFrame:
NSMakeRect(0,0,100,16) ];
newCell = [[foo cell] copy];
[newFoo setCell:newCell];
[newCell release];
}
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden