buttons.rb example crashes on exit
Reported by lyle (at lylejohnson) | November 11th, 2009 @ 06:46 PM
When you're running it under Ruby 1.9.1 (which OS?), the buttons.rb program crashes on exit.
Comments and changes to this ticket
-
lyle (at lylejohnson) November 11th, 2009 @ 07:03 PM
- Tag set to rubyforge
-
Sven A. April 21st, 2011 @ 08:19 AM
- Milestone order changed from 0 to 0
This happens also under Debian Squeeze running ruby 1.9.2-p180 and fxruby-1.6.20.
It seems that the destruction of the application is not working correctly, because
the following change - a bottom-up removal of all children before exiting - fixes
the crash:--- button.rb 2011-04-21 10:05:17.612782000 +0200 +++ button.rb.fixed 2011-04-21 10:07:27.540782516 +0200 @@ -129,7 +129,14 @@ FXRadioButton.new(group4, "Apart", @group4_dt, FXDataTarget::ID_OPTION + 3) quitButton = FXButton.new(controls, "&Quit", :opts => FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X) - quitButton.connect(SEL_COMMAND) { getApp().exit(0) } + quitButton.connect(SEL_COMMAND) { clean_up(self); getApp().exit(0) } + end + + def clean_up(component) + component.children.each do |child| + clean_up(child) + component.removeChild(child) + end end # Load the named icon from a file
-
Lars Kanis February 16th, 2012 @ 08:33 PM
- Assigned user set to lyle (at lylejohnson)
This is solved in 1.6.22.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
FXRuby is a library for developing powerful and sophisticated cross-platform graphical user interfaces (GUIs) for your Ruby applications. It’s based on the FOX Toolkit, a popular open source C++ library developed by Jeroen van der Zijp. What that means for you as an application developer is that you’re able to write code in the Ruby programming language that you already know and love, while at the same time taking advantage of the performance and functionality of a featureful, highly optimized C++ toolkit.