noreply at rubyforge.org
2007-Oct-03 15:59 UTC
[wxruby-development] [ wxruby-Patches-14416 ] Patch for Bug [#12747] Crash on exit
Patches item #14416, was opened at 2007-10-03 15:59 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=220&aid=14416&group_id=35 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Christopher Bludau (count_cb) Assigned to: Nobody (None) Summary: Patch for Bug [#12747] Crash on exit Initial Comment: Patch for the bug [#12747] Crash on exit in file etc/activation.rb The problem is, that the window gets destroyed and then for whatever reasons the on_activate event fires and the on_activate method tries to set a status text of a window that is alreay destroyed. The same happens when one window is closed and then the other window is closed via the menu. Now the method close_all tries to close both windows. But one is already destroyed so the app crashes. I solved this by defining an attribute @closed = false in the MinimalFrame and defining a method closed? which returns the @closed attribute. The close event sets this attribute to true (evt_close { |e| @closed = true, e.skip }) And then I changed the on_activate and close_all method to this: def on_activate(event) if !closed? if event.get_active puts "Frame ''#{get_title}'' became activated" set_status_text ''Active'' else puts "Frame ''#{get_title}'' became deactivated" set_status_text ''Inactive'' end event.skip # important end end and def close_all if !@frame_1.closed? @frame_1.close() end if !@frame_2.closed? @frame_2.close() end end No you can close the windows in any way and the application doesn''t crash File with changes attached ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=220&aid=14416&group_id=35
Maybe Matching Threads
- [1076] trunk/wxruby2/samples/etc/activation.rb: Added sample of IconizeEvent to activation sample
- use of specaccum in routine procedure
- [903] branches/wxruby2/wxwidgets_282/samples: Added #!/usr/bin/env ruby to the grid sample.
- [875] trunk/wxruby2/samples: Add expanded grid sample
- Rails Beginner.. NoMethodError