[fxruby-users] Issue with callback

Jamey Cribbs jcribbs at twmi.rr.com
Tue Jul 26 21:55:11 EDT 2005


Roy Sutton wrote:

> I'm experiencing an interesting issue with FXRuby 1.2.6 on Windows.  I 
> have the following code:
>
>        self.accelTable.addAccel(fxparseAccel("Ctrl-F4"), self, 
> FXSEL(SEL_COMMAND, FXApp::ID_LAST+124))
>        FXMAPFUNC(SEL_COMMAND, FXApp::ID_LAST+124,          
> :do_close_file)
>
> Then later:
>
>      def do_close_file(sender, sel, ptr)
>           puts(sender);
>           puts(sel);
>           puts(ptr);
>      end
>
> This code always crashes with a segementation fault at puts(ptr);  I 
> believe ptr should contain the ID of the message (FXApp::ID_LAST+124).
>
Roy, this won't help much, but I had a very similar problem using 
addAccel.  I don't remember the details, but a few months ago I was 
working on a fairly complex app.  I had a lot of the menu items mapped 
to the accelTable using addAccel.  Well, I remember that my app started 
crashing with a seg fault.  I was able to trace it to the accelTable.  I 
tried everything I could to track down the problem.  I finally narrowed 
it down to, I think, a problem where Ruby's garbage collector was 
prematurely collecting one of my references.  I can't really remember 
more than that.

I ended up removing all of the addAccel code and figured out a different 
way to add hotkey support (I think I ended up trapping for the actual 
key codes).

Sorry for the vagueness, the old memory cells go fast at my age.  :-)

Jamey Cribbs


More information about the fxruby-users mailing list