Forum: Ruby RubyCocoa crash

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Alwyn (Guest)
on 2006-03-16 10:44
(Received via mailing list)
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
Jonathan Paisley (Guest)
on 2006-03-16 13:53
(Received via mailing list)
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.
This topic is locked and can not be replied to.