• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSSegmentedControl seems to leak with the copy protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSSegmentedControl seems to leak with the copy protocol
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: NSBrowser and Binding
  • Next by Date: turning the focus ring off on 10.2
  • Previous by thread: Re: NSBrowser and Binding
  • Next by thread: Re: NSSegmentedControl seems to leak with the copy protocol
  • Index(es):
    • Date
    • Thread