Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Greg Parker
On May 16, 2011, at 7:15 PM, Nick Zitzmann wrote: > On May 16, 2011, at 8:05 PM, Greg Parker wrote: >> >> Don't bother. The menu zone is gone as of Snow Leopard. -setMenuZone: does >> nothing, and -menuZone always returns the default malloc zone. > > Really? Good to know. I filed bug #9450065 on

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Nick Zitzmann
On May 16, 2011, at 8:05 PM, Greg Parker wrote: >> That's not true with NSMenu; the OP actually had it right: >> > > Don't bo

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Greg Parker
On May 16, 2011, at 6:16 PM, Nick Zitzmann wrote: > On May 16, 2011, at 5:49 PM, Conrad Shultz wrote: >> >> On 5/16/11 4:04 PM, Martin Batholdy wrote: >>> Hi, >>> >>> I create an NSMenu by myself; >>> >>> menu = [[NSMenu allocWithZone:menuZone] init]; >> >> What Nick said. >> >> Plus, you almo

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/16/11 6:16 PM, Nick Zitzmann wrote: >> Plus, you almost never want to use -allocWithZone:. Zones are a >> particularly arcane subject and explicit determination of a zone is >> best avoided. > > That's not true with NSMenu; the OP actually had

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Nick Zitzmann
On May 16, 2011, at 5:49 PM, Conrad Shultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 5/16/11 4:04 PM, Martin Batholdy wrote: >> Hi, >> >> I create an NSMenu by myself; >> >> menu = [[NSMenu allocWithZone:menuZone] init]; > > What Nick said. > > Plus, you almost never wa

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/16/11 4:44 PM, Martin Batholdy wrote: > Is this how you would do it properly: > > newItem = [[NSMenuItem alloc] initWithTitle:aTitle action:@selector(show:) > keyEquivalent:@""]; > > [menu addItem:newItem]; > // with the addItem command newIt

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/16/11 4:04 PM, Martin Batholdy wrote: > Hi, > > I create an NSMenu by myself; > > menu = [[NSMenu allocWithZone:menuZone] init]; What Nick said. Plus, you almost never want to use -allocWithZone:. Zones are a particularly arcane subject and e

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Martin Batholdy
> Also, you are double-initializing the object, and under no circumstances > should you ever do that. Ok, thanks for pointing that out ... I still overlook these things ... Ok ... now I tried to reread the official documents ... Is this how you would do it properly: newItem = [[NSMenuItem al

Re: how to create a NSMenuItem without memory leaks

2011-05-16 Thread Nick Zitzmann
On May 16, 2011, at 5:04 PM, Martin Batholdy wrote: > Hi, > > I create an NSMenu by myself; > > menu = [[NSMenu allocWithZone:menuZone] init]; > > And depending on some data NSMenuItems get created. > > > Now these menuItems get deleted and redrawn depending on some actions of the > user wi

how to create a NSMenuItem without memory leaks

2011-05-16 Thread Martin Batholdy
Hi, I create an NSMenu by myself; menu = [[NSMenu allocWithZone:menuZone] init]; And depending on some data NSMenuItems get created. Now these menuItems get deleted and redrawn depending on some actions of the user with [menu removeItemAtIndex: x]; I create the menu items like this: newIt