Bugs: Browse | Submit New | Admin
wxRuby protects MenuBar and its associated Menus from GC by marking them via their associated frame. It is possible that a partially-created menu might be incorrectly destroyed before it's associated with a Frame, if GC is triggered during the set-up of the menu and the Menus are not connected by instance variables. For example menubar = Wx::MenuBar.new(...) menubar.append(SomeMenuSubClass.new) # GC can be triggered here frame.menubar = menubar Tricky to fix in GC without being over-conservative and always preserving menus. Workaround is to connect the MenuBar to the frame early using menubar=
Add A Comment:
Date: 2011-05-23 04:09 Sender: Chauk-Mean Proum Another workaround would be to disable the garbage collector during the application startup. Garbage collector disabling/reenabling could be possibly done by wxRuby.
Date: 2011-05-22 10:30 Sender: Alex Fenton Potential fix - make wxRuby_markMenuBarBelongingToFrame the markfunc of MenuBar, but add code in to setWindowDeleted to check if a frame, with menubar, and unlink the menubar at that point so it is not later incorrectly marked.