Hi Gabriel, You can safely remove all the retain, release and autorelease messages from your code, as they are not needed in MacRuby (because it uses garbage collection). Laurent On Dec 14, 2010, at 11:51 AM, Gabriel Gilder wrote:
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
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel