# RubyCocoa crash

**URL:** <https://www.ruby-forum.com/t/rubycocoa-crash/55017>\
**Category:** Ruby\
**Created:** [March 16, 2006, 9:44am UTC](https://www.ruby-forum.com/t/rubycocoa-crash/55017 "2006-03-16T09:44:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alwyn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e274bd/32.png) [@Alwyn](https://www.ruby-forum.com/u/Alwyn)\
**Post date:** [March 16, 2006, 9:44am UTC](https://www.ruby-forum.com/t/rubycocoa-crash/55017/1 "2006-03-16T09:44:10Z")

</div>

I am trying to implement a delegate method of NSSpeechSynthesizer as  
follows:

def speechSynthesizer\_didFinishSpeaking(sender, finished)

but when the method is invoked, a crash occurs in objc\_msgSend.

If I delete the second formal parameter, thus:

def speechSynthesizer\_didFinishSpeaking(sender)

the script runs correctly and the method executes as desired.

However, the Objective-C signature of this method is:

- (void)speechSynthesizer:(NSSpeechSynthesizer \*)sender  
didFinishSpeaking:(BOOL)finishedSpeaking

This means that the second parameter of this method appears not to be  
available to users of RubyCocoa.

Does anyone know what the problem is?

Alwyn

---

<div class="post-metadata">

**Author:** ![Alwyn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e274bd/32.png) [@Alwyn](https://www.ruby-forum.com/u/Alwyn)\
**Post date:** [March 16, 2006, 12:53pm UTC](https://www.ruby-forum.com/t/rubycocoa-crash/55017/2 "2006-03-16T12:53:15Z")

</div>

On Thu, 16 Mar 2006 17:43:47 +0900, Alwyn wrote:

> def speechSynthesizer\_didFinishSpeaking(sender, finished)

> - (void)speechSynthesizer:(NSSpeechSynthesizer \*)sender  
> didFinishSpeaking:(BOOL)finishedSpeaking
> 
> This means that the second parameter of this method appears not to be  
> available to users of RubyCocoa.

Please report it as a bug on the sourceforge tracker for RubyCocoa.  
Also,  
please repost your message to the RubyCocoa-talk mailing list so there’s  
a  
record of it there.

In the meantime, try putting this in front of your method definition:

addRubyMethod\_withType(“speechSynthesizer:didFinishSpeaking:”,“i@:@i”)  
def speechSynthesizer\_didFinishSpeaking(sender,finished)  
…

Note that the argument ‘finished’ will be an integer, so if you want to  
check it for truth you need finished!=0.
