Hi,

I am getting pretty close to releasing some Camelbones code on Sourceforge, although I am not sure if it can serve as an example to others.
(It will feature a partly functional browser view, system services, add-on services, pasteboard access and a dynamic dock menu though).

But first I have a question about memory management:
In the Objective-C samples there is always a great deal of retains and releases.
Do I need to care about that in Camelbones?

Specifically I have a function to create my dock menu which just creates a whole new menu every time it needs updating.
The old menu is left to the Perl garbage collector.
Is that okay or should I "release" it first?

Here is the code fragment:

sub update_dock_menu{
my $self = shift;

my $menu = $self->{DockMenu} = NSMenu->alloc->init;

$menu->addItemWithTitle_action_keyEquivalent('Transform pasteboard:', undef, '');
while (my ($label, $coderef) = each %$PerlPad::_functions){
$menu->addItemWithTitle_action_keyEquivalent(" $label",undef,'');
}

}


Cheers,

Thilo

Reply via email to