FXRuby 1.0.21 FXOptionMenu problem

Hi

I’ve got a bit of a problem using the FXOptionMenu widget in FXRuby

here’s my setup:
ruby-1.6.8
FXRuby-1.0.21
fox-1.0.36

Basically, whenever I use an FXOptionMenu, or specifically an FXOption
to which i then “.connect(SEL_COMMAND)” some code to, changing to that
option when the app is running results in the following error being
printed out on the commandline:

FXRuby.cpp(667): FXASSERT(FALSE) failed.

Looking into FXRuby.cpp, this assertion is at the tail end of
FXRbConvertMessageData, and seems to indicate that the ‘type’ of the
sel (of |sender, sel, ptr| fame) is not recognised - it should be a
SEL_COMMAND, so that makes sense given the code - so the ‘sender’ is
of an unknown FXMETACLASS. Again scanning through this code, there is
no ‘else if’ clause for FXOption (nor FXLabel, it’s superclass). I
hope this gives someone (lyle? pleeeeeeeease? :wink: some clues, it’s
about as far as I can get withuot really getting stuck into the fox
code.

I’ve replicated this with my own software and also, after
investigation, with the FXRuby example programs - dctest.rb produces
this and uses FXOption.connect(SEL_COMMAND), whilst dialog.rb uses a
’neutered’ FXOptionMenu whose commands don’t do anything, and it
doesn’t exhibit this error.

Firstly is this just my setup? Can anyone replicated this problem? And
secondly, any idea how to sort it?

[nb. as an aside, it seems to trigger segfaults within random OpenGL
calls, usually resulting in [BUG] rb_gc_mark() errors. this might just
be my code, but then i ‘neuter’ the FXOptionMenu the problem
disappears]

Thanks as usual in advance,

  • James Adam

James Adam wrote:

Basically, whenever I use an FXOptionMenu, or specifically an FXOption
to which i then “.connect(SEL_COMMAND)” some code to, changing to that
option when the app is running results in the following error being
printed out on the commandline:

FXRuby.cpp(667): FXASSERT(FALSE) failed.

This is a bug. If you want to locally patch your code, add the following
snippet in FXRbConvertMessageData():

else if(sender->isMemberOf(FXMETACLASS(FXOption))){
if(type==SEL_COMMAND)
return to_ruby(reinterpret_cast<FXEvent*>(ptr));
}

Based on the fact that you’ve already been looking at that function, I
think you’ll see where to add it. This will be fixed for FXRuby-1.0.22.

[nb. as an aside, it seems to trigger segfaults within random OpenGL
calls, usually resulting in [BUG] rb_gc_mark() errors. this might just
be my code, but then i ‘neuter’ the FXOptionMenu the problem
disappears]

Yes. If we don’t recognize the sender & message type for the message
(e.g. a SEL_COMMAND message from an FXOption instance) we just pass
through the message data as-is, assuming it’s a valid Ruby object. This
was done in the event that you create your own widgets with special
message data. Since in this case the message data is not a Ruby object
(but rather a pointer to a C++ FXEvent object) you’ll eventually get a
runtime error of some sort.