Absolutely no problems nor segfaults! ruby 1.7.3 (2002-10-18) [i386-linux-gnu] fox-1.0.26-1 FXRuby-1.0.14-1 RH7.1, kernel 2.4.19 Joel VanderWerf wrote: > > If I run this and press the "Pow!" button twice, I get a segfault. I've > tried whittling the example down, but everything seems to play a role... > > Turning off GC prevents it, so it may be that something's not getting > marked correctly. > > Versions: > > FXRuby 1.0.13 > Fox 1.0.11 > Ruby 1.6.7 > Mandrake-Linux 8.1 > > > ------------------------------------------------------------------------ > > #!/usr/bin/env ruby > > require "fox" > include Fox > > if false > puts "disabling GC" > GC.disable ### prevents SEGFAULT > end > > class BugWindow < FXMainWindow > include Responder > > def initialize(app) > super(app, "Bug", nil, nil, DECOR_ALL, 0, 0, 0, 0) > > splitter = FXSplitter.new(self, (LAYOUT_SIDE_TOP|LAYOUT_FILL_X| > LAYOUT_FILL_Y| SPLITTER_TRACKING|SPLITTER_VERTICAL|SPLITTER_REVERSED)) > > contents = FXHorizontalFrame.new(splitter, > LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) > > table_frame = FXHorizontalFrame.new(contents, > FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y) > > @table = FXTable.new(table_frame, 0, 0, nil, 0, > TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y, > 0,0,0,0, 2,2,2,2) > > @table.disable > @table.setFont(FXFont.new(getApp(), "courier", 9, FONTWEIGHT_LIGHT)) > > FXButton.new(splitter, "&Pow!", nil, self). > connect(SEL_COMMAND, method(:onPow)) > end > > def onPow(sender, sel, index) > foo ### this seems to be necessary for SEGFAULT > @table.setTableSize 0,0 > > # make some garbage > dummy = nil > 100000.times do |i| > dummy = [i]*10 > end > > @table.setTableSize(1000, 10) > > @table.enable ### this seems to be necessary for SEGFAULT > > return 1 > end > > def foo > nr = @table.numRows > nc = @table.numCols > > (1..nc-2).each { |c| > item = @table.getItem(nr-1, c) ### 'item = ' seems to be necessary > } > end > > def create > position(200, 200, 600, 400) > super > show > end > end > > application = FXApp.new("TEST", "TEST") > application.init(ARGV) > window = BugWindow.new(application) > application.create > application.run -- Wai-Sun "Squidster" Chia Consulting & Integration Linux/Unix/Web Developer Dude