• 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
Odd Cocoa user interface problem with GarageBand.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd Cocoa user interface problem with GarageBand.


  • Subject: Odd Cocoa user interface problem with GarageBand.
  • From: Ian Kemmish <email@hidden>
  • Date: Sun, 26 Mar 2006 15:31:32 +0100

The background to this problem is that I added some accounting code to my AU to make sure that every parameter and property listener that got created by my UI also got removed. I noticed that I got a host of warnings from this code when Garageband exited.

I added some diagnostic code to the dealloc method of one of my views, like so:

- (void) dealloc
{
    int a, b, c, d, e, f, g, h;
    NSMenu *m;
    NSMenuItem *i;
    id s1, s2;
    a = [sourcePopUp retainCount];
    m = [sourcePopUp menu];
    b = [m retainCount];
    i = (NSMenuItem *) [m itemAtIndex: [m numberOfItems] - 1];
    c = [i retainCount];
    s1 = [i representedObject];
    d = [s1 retainCount];
    e = [breakpointAmountPopUp retainCount];
    m = [breakpointAmountPopUp menu];
    f = [m retainCount];
    i = (NSMenuItem *) [m itemAtIndex: [m numberOfItems] - 1];
    g = [i retainCount];
    s2 = [i representedObject];
    h = [s2 retainCount];

.....
}

Now, if I run under either my own test harness or under AU Lab, all the retain counts a - h are 1, which is also what I would expect to see. If I run under GarageBand, the counts b and f (the retain counts for the two NSMenu's) are 2, not 1. (The objects sourcePopUp and breakpointAmountPopUp are both bog-standard NSPopUpButtons, and the whole view is loaded from a nib file.)

This means that the menus, and more importantly, the objects s1 and s1 which I've stuffed into the representedObject slots, never get released. It is the release of these objects which triggers the removal of some of the property listeners by a manager which is shared between pop up buttons.

It could be that things are just getting released in a different order under GarageBand (this dealloc method gets called from NSPopAutoreleasePool()), but as far as I can see that isn't the case: the objects s1 and s2 never get released before GarageBand exits.


When it's one of my own classes, I can trace calls to release and retain with custom versions of these methods in my class, but unless some Cocoa expert knows better, I don't think I can do that for NSMenu?




- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ian Kemmish 18 Durham Close, Biggleswade, Beds SG18 8HZ
email@hidden Tel: +44 1767 601361 Mob: +44 7952 854387
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Re: Varispeed AU configuration with QT audio extraction?
  • Next by Date: Re: Another approach to root user?
  • Previous by thread: Re: Setting kAudioDevicePropertyBufferFrameSize
  • Next by thread: Controlling input volume while recording
  • Index(es):
    • Date
    • Thread