[MacRuby-devel] Assertion failed in rb_vm_super_lookup

John Shea johnmacshea at gmail.com
Fri Nov 27 00:07:30 PST 2009


Hi Gareth,

Have a look at the examples in Developer/Examples/Ruby/MacRuby - there are
good examples there which might be useful for you.

In this case your init method is an obvious problem, it must (as in
objective C) return self.

The super call is interesting because normally in ruby it will call your
current method in the super class and magically pass on parameters you had
to the current object's method to the super class.

I cannot find an example of super.method in Pickaxe, but nonetheless
super.initWithSomething(params) - has worked fine for me. Someone will
correct me, I am sure, i this is wrong.

so you could try:
def init
if (super initWithWindowNibName('preferences'))
                #initialisation stuff
return self
end
nil
end

or more or less the same:

def init
result = super.initWithWindowNibName('Preferences')
if result
#other initialisation
end
result
end

cheers,
John

On Fri, Nov 27, 2009 at 12:51 AM, Gareth Townsend <gareth.townsend at me.com>wrote:

> Hi,
>
> I've just started playing with MacRuby. So please bear with me, there's
> every chance I'm doing something stupid :-) I'm using 0.5 beta 2.
>
> I'm building a simple Cocoa App (http://github.com/quamen/noise) and am
> running into some problems while trying to set up a Preference Pane.
>
> Specifically this error:
>
> > Assertion failed: (m != NULL), function rb_vm_super_lookup, file
> dispatcher.cpp, line 228.
>
> Followed by a whole heap of warnings that seem to hard coded to Laurent's
> machine
>
> Program received signal:  “SIGABRT”.
> > sharedlibrary apply-load-rules all
> > warning: Could not find object file
> "/Users/lrz/src/macruby-clean/array.o" - no debug information available for
> "array.c".
> >
> > warning: Could not find object file
> "/Users/lrz/src/macruby-clean/bignum.o" - no debug information available for
> "bignum.c".
> >
> > ...
>
>
> This occurs when I try to instantiate an NSWindowController subclass. My
> Code:
>
> > def open_preferences(sender)
> >       NSLog('open preferences')
> >       preference_controller ||= PreferencesController.new
> >       preference_controller.showWindow(self)
> > end
>
> > class PreferencesController < NSWindowController
> >       def init
> >               if (super initWithWindowNibName('preferences'))
> >                       self
> >               else
> >                       nil
> >               end
> >       end
> >
> > end
>
>
> I have a .xib file called 'preferences.xib'
>
> So can anyone spot something stupid? If not, how should I go about
> debugging this?
>
> Cheers,
> Gareth Townsend
> http://www.garethtownsend.info
> http://www.melbournecocoaheads.com
>
>
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091127/71353f4e/attachment.html>


More information about the MacRuby-devel mailing list