[MacRuby-devel] 0.2 available for testing

Stephen Bannasch stephen.bannasch at deanbrook.org
Thu Jun 5 12:02:01 PDT 2008


At 10:50 AM -0700 6/5/08, Laurent Sansonetti wrote:
>Hi Stephen,
>
>On Jun 5, 2008, at 10:40 AM, Stephen Bannasch wrote:
>
>> I've just started playing with MacRuby.
>>
>> Updated to the latest testing release and installed the normal way as
>> /usr/local/bin/macruby (instead of trying to install in a non-system
>> dir).
>>
>> Copied /Developer/Examples/Ruby/MacRuby to a working folder and ran
>> all the demos.
>>
>> Everything worked except for CircleView. Interacting with the UI
>> caused the app to exit with status 1.
>>
>> I'm not very familiar with xcode but at the bottom of the project
>> window was this statement:
>
>Interesting, it seems to work fine for me. Do you have a way to 
>reproduce the crash?
>
>> Questions:
>>
>> CircleView exited with status 1. The Debugger is still running. Use
>> 'Restart' to debug again.

OK, some of this is very simple but it might be helpful for someone else starting.

Open menu: Run::Debugger to see he Debugger window and the Restart button.

> >
>> Where and how can I get more info about this error. Is there a
>> console window in xcode?

Yes, menu: Run::Console

>I changed the Active Build Configuration to
>> Debug and ran again bug got no more info.
>>
>> Is there a MacRuby code debugger for the Ruby code?
>>
>> What are basic strategies I can do to figure out if this is a Ruby,
>> MacRuby, or Core issue?
>
>It really depends on the error. If it crashes, it's more probably a 
>MacRuby bug. If it just exists at the middle of the program execution, 
>it's also more probably a MacRuby bug. If the program exists with a 
>Ruby exception, then it might be either a MacRuby bug, or a bug in the 
>application itself.

After updating to 10.5.3 the CircleVIiew still crashes. The crash report in the xcode console below happened when I started the app and clicked the Spin button.

#<NSCFTimer:0x14ed2b0>
/Users/stephen/dev/MacRuby/examples/CircleView/build/Debug/CircleView.app/Contents/Resources/CircleView.rb:52:in `block in drawRect': undefined method `lineFragmentRectForGlyphAtIndex' for nil:NilClass (NoMethodError)
	from /Users/stephen/dev/MacRuby/examples/CircleView/build/Debug/CircleView.app/Contents/Resources/CircleView.rb:51:in `upto'
	from /Users/stephen/dev/MacRuby/examples/CircleView/build/Debug/CircleView.app/Contents/Resources/CircleView.rb:51:in `drawRect'
	from /Users/stephen/dev/MacRuby/examples/CircleView/build/Debug/CircleView.app/Contents/Resources/rb_main.rb:22:in `NSApplicationMain'
	from /Users/stephen/dev/MacRuby/examples/CircleView/build/Debug/CircleView.app/Contents/Resources/rb_main.rb:22:in `<main>'

Here's lines 51..52 from CircleView.rb

    glyphRange.location.upto(glyphRange.location + glyphRange.length - 1) do |i|
      lineFragmentRect = @layoutManager.lineFragmentRectForGlyphAtIndex i, effectiveRange:nil

So @layoutManager appears to be nil.

It doesn't appear I can add a breakpoint to CircleView.rb. Cmd-\ has no visible effect.

Is there a debugger I can use with this MacRuby code to see if @layoutManager is getting set correctly and if it is what's happening to make it nil?



More information about the MacRuby-devel mailing list