Assertion failed in rb_vm_super_lookup
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
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@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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hi Gareth, On Nov 26, 2009, at 3:51 PM, Gareth Townsend 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.
Sorry about that, this shouldn't happen. I will try to reduce this and add it to our test suite.
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?
I guess you tried to translate [super initWithWindowNibName:@"preferences"] here. The problem is that super in Ruby doesn't work exactly the same as in Objective-C. super in Objective-C allows you to call any super method while in Ruby it will always call the super version of the caller (here, init). In your PreferencesController class, unless you overwrote initWithWindowNibName:, you can simply call it without super. class PreferencesController def init initWithWindowNibName('preferences') end end As John wrote earlier, init should always return self (or nil if there was an error). Here, initWithWindowNibName: is supposed to return self or nil in case of an error, so we can simply return its return value. Laurent
Thanks for the quick replies and explanations John and Laurent. My problem is sorted and my window is opening :-) The hardest part of building stuff with MacRuby is figuring out whether the Ruby, or the Cocoa way, is the correct way to do things. Cheers, Gareth Townsend http://www.garethtownsend.info http://www.melbournecocoaheads.com
participants (3)
-
Gareth Townsend
-
John Shea
-
Laurent Sansonetti