I did notice I was getting the same error and crash when I was calling
Objective-C/C methods with blocks that didn't name the parameters in their
typing such as void(^)(NSInteger) instead of void(^)(NSInteger result) but all
of Apple's API name the parameters. It could be something else in MacRuby
though it's hard to say.
What version of Ruby/OS X are you running?
-Robert
On Feb 14, 2011, at 7:16 AM, Jonathan Waddilove wrote:
> OK, thanks for having a look.... I thought I'd raise the issue incase it's a
> bug that needs addressing before 1.0
>
> I guess it could be something subtle in my environment.
>
> best wishes, Jonathan
>
> On 13 Feb 2011, at 18:11, Robert Payne wrote:
>
>> I just updated to the latest source just to be safe and I'm still not
>> getting any issues with it... someone else might be able to help.
>>
>> -Robert
>>
>> On 14/02/2011, at 7:01 AM, Jonathan Waddilove wrote:
>>
>>> Hello Robert,
>>>
>>> Sorry, I must be using the 'other' macirb ;-) - still doesn't work, here's
>>> the output
>>>
>>> JTW:~ jonathan$ macirb
>>> irb(main):001:0> framework "Cocoa"
>>> => true
>>> irb(main):002:0> a = [0,1,2,3,4]
>>> => [0, 1, 2, 3, 4]
>>> irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>> irb(main):004:1> puts "#{object}"
>>> irb(main):005:0> })
>>> Segmentation fault
>>> JTW:~ jonathan$
>>>
>>> regards, Jonathan
>>>
>>> On 13 Feb 2011, at 17:55, Robert Payne wrote:
>>>
>>>> Hi Jonathan,
>>>>
>>>> Can you try just exactly this in macirb?
>>>>
>>>> framework "Cocoa"
>>>> a = [0,1,2,3,4]
>>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>>> puts "#{object}"
>>>> })
>>>>
>>>> It's working over here in MacIrb
>>>> On 14/02/2011, at 6:52 AM, Jonathan Waddilove wrote:
>>>>
>>>>> Hi Robert, Thanks for the quick response.
>>>>>
>>>>> I'm using trunk (installed straight from the MacRuby front page). For
>>>>> what it's worth I have both Xcode3 and Xcode4 installed but can happily
>>>>> reproduce the error in textmate/xcode3/macirb
>>>>>
>>>>> regards Jonathan
>>>>>
>>>>> On 13 Feb 2011, at 17:31, Robert Payne wrote:
>>>>>
>>>>>> Hi Jonathan,
>>>>>>
>>>>>> The syntax looks good and it works on my end. Are you using a nightly of
>>>>>> MacRuby or the 0.8 trunk?
>>>>>>
>>>>>> a = [0,1,2,3,4]
>>>>>> puts "#{a}"
>>>>>> a.enumerateObjectsUsingBlock(Proc.new{|object, index, stop|
>>>>>> puts "object: #{object}"
>>>>>> })
>>>>>>
>>>>>> On 14/02/2011, at 5:55 AM, Jonathan Waddilove wrote:
>>>>>>
>>>>>>> Hi, another MacRuby 0.9 question...
>>>>>>>
>>>>>>> I've been trying to use lambda and/or Proc.new to provide callback
>>>>>>> blocks (as suggested in Matt's excellent draft book). Again I have seen
>>>>>>> discussions about problems in this area and for me all the suggested
>>>>>>> variants of code fail.
>>>>>>>
>>>>>>> Here's a snip of failing code:
>>>>>>>
>>>>>>> #!/usr/local/bin/macruby
>>>>>>> puts "Ruby Version: #{RUBY_VERSION}, MacRuby Version:
>>>>>>> #{MACRUBY_VERSION}"
>>>>>>>
>>>>>>> a = [1, 2, 3, 4, 5,]
>>>>>>>
>>>>>>> a.enumerateObjectsUsingBlock(Proc.new {|obj, index, stop|
>>>>>>> puts "I'll bet this never displays"
>>>>>>> })
>>>>>>>
>>>>>>> and here's the resulting crash...
>>>>>>>
>>>>>>> Any suggestions? many thanks, Jonathan
>>>>>>>
>>>>>>>
>>>>>>> Process: macruby [23078]
>>>>>>> Path:
>>>>>>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin/macruby
>>>>>>> Identifier: macruby
>>>>>>> Version: ??? (???)
>>>>>>> Code Type: X86-64 (Native)
>>>>>>> Parent Process: ruby [23074]
>>>>>>>
>>>>>>> Date/Time: 2011-02-13 16:50:33.806 +0000
>>>>>>> OS Version: Mac OS X 10.6.6 (10J567)
>>>>>>> Report Version: 6
>>>>>>>
>>>>>>> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
>>>>>>> Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
>>>>>>> Crashed Thread: 0 Dispatch queue: com.apple.main-thread
>>>>>>>
>>>>>>> Application Specific Information:
>>>>>>> objc[23078]: garbage collection is ON
>>>>>>>
>>>>>>> Thread 0 Crashed: Dispatch queue: com.apple.main-thread
>>>>>>> 0 ??? 000000000000000000 0 + 0
>>>>>>> 1 ??? 0x0000000102d63ac6 0 +
>>>>>>> 4342561478
>>>>>>> 2 libmacruby.dylib 0x000000010014a0b3
>>>>>>> rb_vm_dispatch + 1331
>>>>>>> 3 ??? 0x0000000102d5a536 0 +
>>>>>>> 4342523190
>>>>>>> 4 ??? 0x0000000102d63806 0 +
>>>>>>> 4342560774
>>>>>>> 5 libmacruby.dylib 0x0000000100162d53 rb_vm_run +
>>>>>>> 531
>>>>>>> 6 libmacruby.dylib 0x00000001000408f0
>>>>>>> ruby_run_node + 80
>>>>>>> 7 macruby 0x0000000100000d28 main + 152
>>>>>>> 8 macruby 0x0000000100000c88 start + 52
>>>>>>>
>>>>>>> Thread 1:
>>>>>>> 0 libSystem.B.dylib 0x00007fff88fe5f8a
>>>>>>> __workq_kernreturn + 10
>>>>>>> 1 libSystem.B.dylib 0x00007fff88fe639c
>>>>>>> _pthread_wqthread + 917
>>>>>>> 2 libSystem.B.dylib 0x00007fff88fe6005
>>>>>>> start_wqthread + 13
>>>>>>>
>>>>>>> Thread 0 crashed with X86 Thread State (64-bit):
>>>>>>> rax: 0x00007fff5fbfddc0 rbx: 0x0000000000000000 rcx:
>>>>>>> 0x00007fff5fbfdf0f rdx: 0x0000000000000000
>>>>>>> rdi: 0x00000002000bed00 rsi: 0x00000002000bec00 rbp:
>>>>>>> 0x00007fff5fbfdf40 rsp: 0x00007fff5fbfdcf8
>>>>>>> r8: 0x0000000200000000 r9: 0x0000000000000005 r10:
>>>>>>> 0x0000000000000001 r11: 0x0000000100af9000
>>>>>>> r12: 0x00000002000bec00 r13: 0x0000000000000000 r14:
>>>>>>> 0x0000000000000005 r15: 0x0000000000000000
>>>>>>> rip: 0x0000000000000000 rfl: 0x0000000000010246 cr2:
>>>>>>> 0x0000000000000000
>>>>>>>
>>>>>>> Binary Images:
>>>>>>> 0x100000000 - 0x100000ff7 +macruby ??? (???)
>>>>>>> <4408616F-9F77-025F-C278-91F945728AB0> /usr/local/bin/macruby
>>>>>>> 0x100003000 - 0x100a29fd7 +libmacruby.dylib 0.8.0 (compatibility
>>>>>>> 0.8.0) <8910242D-90F3-32AC-A4CA-99D5C316AEB8>
>>>>>>> /Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/libmacruby.dylib
>>>>>>> 0x7fff5fc00000 - 0x7fff5fc3bdef dyld 132.1 (???)
>>>>>>> <486E6C61-1197-CC7C-2197-82CE505102D7> /usr/lib/dyld
>>>>>>> 0x7fff801f1000 - 0x7fff802aafff libsqlite3.dylib 9.6.0
>>>>>>> (compatibility 9.0.0) <2C5ED312-E646-9ADE-73A9-6199A2A43150>
>>>>>>> /usr/lib/libsqlite3.dylib
>>>>>>> 0x7fff802ba000 - 0x7fff80478fff libicucore.A.dylib 40.0.0
>>>>>>> (compatibility 1.0.0) <781E7B63-2AD0-E9BA-927C-4521DB616D02>
>>>>>>> /usr/lib/libicucore.A.dylib
>>>>>>> 0x7fff809d0000 - 0x7fff80a8dff7 com.apple.CoreServices.OSServices
>>>>>>> 357 (357) <7B22626F-D544-1955-CC53-240F4CACEB4A>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
>>>>>>> 0x7fff815d5000 - 0x7fff815ebfef libbsm.0.dylib ??? (???)
>>>>>>> <42D3023A-A1F7-4121-6417-FCC6B51B3E90> /usr/lib/libbsm.0.dylib
>>>>>>> 0x7fff817b9000 - 0x7fff817bdff7 libmathCommon.A.dylib 315.0.0
>>>>>>> (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5>
>>>>>>> /usr/lib/system/libmathCommon.A.dylib
>>>>>>> 0x7fff81cbb000 - 0x7fff81d05ff7 com.apple.Metadata 10.6.3 (507.15)
>>>>>>> <5170FCE0-ED6C-2E3E-AB28-1DDE3F628FC5>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
>>>>>>> 0x7fff8208d000 - 0x7fff82310ff7 com.apple.Foundation 6.6.4
>>>>>>> (751.42) <AF1E3050-3503-8714-8274-EA6BD6BE8A22>
>>>>>>> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
>>>>>>> 0x7fff82318000 - 0x7fff82340fff com.apple.DictionaryServices 1.1.2
>>>>>>> (1.1.2) <E9269069-93FA-2B71-F9BA-FDDD23C4A65E>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
>>>>>>> 0x7fff8234d000 - 0x7fff8234dff7 com.apple.CoreServices 44 (44)
>>>>>>> <DC7400FB-851E-7B8A-5BF6-6F50094302FB>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
>>>>>>> 0x7fff8353c000 - 0x7fff83588fff libauto.dylib ??? (???)
>>>>>>> <F7221B46-DC4F-3153-CE61-7F52C8C293CF> /usr/lib/libauto.dylib
>>>>>>> 0x7fff83ecb000 - 0x7fff83ed9ff7 libkxld.dylib ??? (???)
>>>>>>> <27713C39-0E51-8F5A-877B-C5539C96A520> /usr/lib/system/libkxld.dylib
>>>>>>> 0x7fff8400d000 - 0x7fff84184fe7 com.apple.CoreFoundation 6.6.4
>>>>>>> (550.42) <770C572A-CF70-168F-F43C-242B9114FCB5>
>>>>>>> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
>>>>>>> 0x7fff85109000 - 0x7fff85144fff com.apple.AE 496.4 (496.4)
>>>>>>> <55AAD5CA-7160-7899-1C68-562ED8160DF7>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
>>>>>>> 0x7fff8532d000 - 0x7fff853bdfff com.apple.SearchKit 1.3.0 (1.3.0)
>>>>>>> <4175DC31-1506-228A-08FD-C704AC9DF642>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
>>>>>>> 0x7fff85405000 - 0x7fff85416ff7 libz.1.dylib 1.2.3 (compatibility
>>>>>>> 1.0.0) <97019C74-161A-3488-41EC-A6CA8738418C> /usr/lib/libz.1.dylib
>>>>>>> 0x7fff8688b000 - 0x7fff869a2fef libxml2.2.dylib 10.3.0
>>>>>>> (compatibility 10.0.0) <B2FB9DA8-6EC9-FFBC-C919-C022B9CBEB73>
>>>>>>> /usr/lib/libxml2.2.dylib
>>>>>>> 0x7fff86a93000 - 0x7fff86af3fe7 com.apple.framework.IOKit 2.0
>>>>>>> (???) <D107CB8A-5182-3AC4-35D0-07068A695C05>
>>>>>>> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
>>>>>>> 0x7fff874bc000 - 0x7fff87539fef libstdc++.6.dylib 7.9.0
>>>>>>> (compatibility 7.0.0) <35ECA411-2C08-FD7D-11B1-1B7A04921A5C>
>>>>>>> /usr/lib/libstdc++.6.dylib
>>>>>>> 0x7fff87940000 - 0x7fff87a12fe7 com.apple.CFNetwork 454.11.5
>>>>>>> (454.11.5) <5D68598D-C138-C8B6-B6AC-B1F48B01E021>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
>>>>>>> 0x7fff8810b000 - 0x7fff881abfff com.apple.LaunchServices 362.2
>>>>>>> (362.2) <A8EDC37C-1D40-5ED0-49BE-90EF110A6B3A>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
>>>>>>> 0x7fff88462000 - 0x7fff886e8fff com.apple.security 6.1.1 (37594)
>>>>>>> <1B4E1ABD-1BB3-DA49-F574-0EEB23E73C6A>
>>>>>>> /System/Library/Frameworks/Security.framework/Versions/A/Security
>>>>>>> 0x7fff886ea000 - 0x7fff886f9fff com.apple.NetFS 3.2.1 (3.2.1)
>>>>>>> <E5D33870-27D2-E50B-9B35-16AA50369733>
>>>>>>> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
>>>>>>> 0x7fff88806000 - 0x7fff88b3afff com.apple.CoreServices.CarbonCore
>>>>>>> 861.23 (861.23) <96465459-6536-3FD7-7504-B59D0390EEC5>
>>>>>>> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
>>>>>>> 0x7fff88bcb000 - 0x7fff88c81fff libobjc.A.dylib 227.0.0
>>>>>>> (compatibility 1.0.0) <99CB3A0F-64CF-1D16-70CD-8AED2EF06C30>
>>>>>>> /usr/lib/libobjc.A.dylib
>>>>>>> 0x7fff88e3d000 - 0x7fff88e7efff com.apple.SystemConfiguration
>>>>>>> 1.10.5 (1.10.2) <FB39F09C-57BB-D8CC-348D-93E00C602F7D>
>>>>>>> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
>>>>>>> 0x7fff88e7f000 - 0x7fff88e85ff7 com.apple.DiskArbitration 2.3
>>>>>>> (2.3) <857F6E43-1EF4-7D53-351B-10DE0A8F992A>
>>>>>>> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
>>>>>>> 0x7fff88f93000 - 0x7fff88fbeff7 libxslt.1.dylib 3.24.0
>>>>>>> (compatibility 3.0.0) <87A0B228-B24A-C426-C3FB-B40D7258DD49>
>>>>>>> /usr/lib/libxslt.1.dylib
>>>>>>> 0x7fff88fcb000 - 0x7fff8918cfff libSystem.B.dylib 125.2.1
>>>>>>> (compatibility 1.0.0) <F00A8B2F-84A0-0868-1047-3A13F9114864>
>>>>>>> /usr/lib/libSystem.B.dylib
>>>>>>> 0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???)
>>>>>>> <F00A8B2F-84A0-0868-1047-3A13F9114864> /usr/lib/libSystem.B.dylib
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> MacRuby-devel mailing list
>>>>>>> [email protected]
>>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>>>
>>>>>> _______________________________________________
>>>>>> MacRuby-devel mailing list
>>>>>> [email protected]
>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>>
>>>>> _______________________________________________
>>>>> MacRuby-devel mailing list
>>>>> [email protected]
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> [email protected]
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel