[fxruby-users] no clean exit

Melton, Ryan rmelton at ball.com
Fri Sep 25 16:28:59 EDT 2009

Fox doesn't handle accelerators correctly at shutdown and it causes lots of crashes:

Try calling this function in a SEL_CLOSE handler for your main window:

  def initialize
    self.connect(SEL_CLOSE, method(:cleanup_menu_panes))

  def cleanup_menu_panes |sender, sel, data|
    ObjectSpace.each_object(FXMenuPane) do |object|
      children = []
      object.each_child do |child|
        children << child
      children.each do |child|

-----Original Message-----
From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of James Johnson
Sent: Friday, September 25, 2009 12:52 PM
To: fxruby-users at rubyforge.org
Subject: Re: [fxruby-users] no clean exit

On Sep 25, 2009, at 1:00 PM, Björn Bergqvist wrote:

> when I quit the application I'm currently developing there is a lot of 
> messages popping up (see below). I've not discovered any problems when 
> running the application, but have I done something wrong?

I don't think you're doing anything wrong. It doesn't seem to happen on every FXRuby app, but I too have seen it crash on exit (from Ruby
1.9.1) in several cases, e.g.


It's been awhile since I've had time to look into this (or much else FXRuby related), but IIRC the problem boils down to the more or less random way that garbage collection occurs during finalization on exit.  
While your program's running, if you (for example) destroy a parent object, FOX will subsequently destroy the child object(s), and the Ruby objects associated with them get cleaned up in an orderly fashion. When the Ruby interpreter is exiting, however, it is possible that the child object will be GC'd before the parent, leaving dangling pointers lying around. I'm not really sure how to fix it at this point.
fxruby-users mailing list
fxruby-users at rubyforge.org

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

More information about the fxruby-users mailing list