Re: [MacRuby] #664: MacRuby Crashes When Scheduling a Block to Run on the Main Thread from a Background Thread
#664: MacRuby Crashes When Scheduling a Block to Run on the Main Thread from a Background Thread ---------------------------------+------------------------------------------ Reporter: dylan@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: #reduction ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * milestone: => MacRuby 1.0 Comment: The following snippet (my suggestion) works fine in trunk. {{{ framework 'Cocoa' NSApplication.sharedApplication def main_thread( &block ) o = Object.new def o.call @block.call end o.instance_variable_set(:@block, block) o.performSelectorOnMainThread( 'call', withObject: nil, waitUntilDone: true ) end Thread.new do main_thread do [1,2,3].each {|i| puts i } end end NSApp.run }}} The original doesn't, as ObjC is not able to perform selectors defined in MacRuby Core (in C), such as Proc#call. We should try to do something in 1.0. -- Ticket URL: <http://www.macruby.org/trac/ticket/664#comment:10> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby