[MacRuby-devel] Error allocating an NSMenu
Gabriel Gilder
gabriel at gabrielgilder.com
Tue Dec 14 11:51:32 PST 2010
Hi,
Just installed MacRuby 0.8 and discovered that my project is generating an
error on a line of code that worked previously... it's in a handler that
creates a contextual menu, but I can recreate the error just by running this
line:
theMenu = NSMenu.alloc.initWithTitle("Contextual Menu").autorelease
The error produced is:
*2010-12-14 11:47:07.275 MenuTest[37416:a0f]
/Users/ggilder/Desktop/MenuTest/build/Debug/MenuTest.app/Contents/Resources/TestController.rb:11:in
`doTest:': undefined method `__hidden__autorelease' for
#<NSMenu:0x2005c1c00> (NoMethodError)*
* from
/Users/ggilder/Desktop/MenuTest/build/Debug/MenuTest.app/Contents/Resources/rb_main.rb:23:in
`<main>'*
If I remove the call to autorelease at the end, it works correctly. The same
thing happens on a similar call, NSMenuItem.alloc.init.autorelease
This code worked fine before the 0.8 release, but I wanted to double-check
whether this code is correct before submitting a bug... I assume that I
should call autorelease for garbage collection, is that wrong?
Thanks!
-Gabriel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101214/f41878d6/attachment.html>
More information about the MacRuby-devel
mailing list