[MacRuby-devel] NSInvocationOperation usage Segmentation fault

Sean Mateus seanlilmateus at googlemail.com
Tue Oct 11 07:20:51 PDT 2011


Hi Alex, try to use: operation =
NSInvocationOperation.alloc.initWithTarget Foo.new, selector: ':bar',
object: nil
the only change is that the selector is a Symbol now! I'm not on any
OS X devices so I can't test this! but I hope it'll work!


Grüßen aus Köln
Sean Mateus


>> The following code crashes with a segmentation fault.
>> Any idea whether I misunderstood the usage or it is a macruby bug?
>>
>> thanks,
>> ALex.

>> ---code-------------------------------------------
>> framework 'Foundation'

>> class Foo
>>   def bar
>>     puts 'bar'
>>   end
>> end

>> operation = NSInvocationOperation.alloc.initWithTarget Foo.new, selector:
>> 'bar', object: nil

>> queue = NSOperationQueue.alloc.init
>> queue.addOperation(operation)

>> # run the main loop for 2 seconds
>> NSRunLoop.currentRunLoop.runUntilDate(NSDate.dateWithTimeIntervalSinceNow(2.0))


More information about the MacRuby-devel mailing list