[fxruby-users] Big tables still segfault with fxruby-1.2.4

David Peoples davidp at touringcyclist.com
Fri Feb 25 08:47:21 EST 2005


I've installed the latest fxruby. (Fox::fxrubyversion() reports 1.2.4.) 
But my installation of fxruby still crashes with a segmentation fault 
when refilling FXTables with large data sets.

My original report was attached to bug #1445. I'm including the test 
code below. The platform is Windows XP, and Ruby is from the one-click 
installer version 182-14 Final.

I'd appreciate it if others could run this code to see if the segfault 
shows up on other machines or just mine.

David Peoples

-------------------------------------------------------------------------

require "fox12"
include Fox

class TestWindow < FXMainWindow

   TABLE_SIZE = 10_000

   def initialize(app)
     super(app, "MyTest", nil, nil, DECOR_ALL, 0, 0, 600, 400, 0, 0)
     mainFrame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
     @table = FXTable.new(mainFrame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
     goButton = FXButton.new(mainFrame, " Go method 1")
     goButton.connect(SEL_COMMAND) { fillTable }
     goButton2 = FXButton.new(mainFrame, " Go method 2")
     goButton2.connect(SEL_COMMAND) { fillTable2 }
   end

   # fails after 2 to 15-20 iterations
   def fillTable
     @table.setTableSize(TABLE_SIZE, 1)
     (0...TABLE_SIZE).each do |r|
       @table.setItemText(r, 0, "#{r}")
     end
     @table.setFocus
   end

   # seems to require more iterations, but still fails
   def fillTable2
     @table.setTableSize(0, 1)
     (0...TABLE_SIZE).each do |r|
       @table.insertRows(r)
       @table.setItemText(r, 0, "#{r}")
     end
     @table.setFocus
   end

   def create
     super
     show(PLACEMENT_SCREEN)
   end

end

def runme
   application = FXApp.new("MyTest", "FoxTest")
   TestWindow.new(application)
   application.create
   application.run
end

runme

-------------------------------------------------------------------------

-- 
David Peoples  davidp at touringcyclist.com  http://www.touringcyclist.com
The Touring Cyclist, 11816 St. Charles Rock Road, Bridgeton MO 63044
tel: 314-739-4648  fax: 314-739-4972


More information about the fxruby-users mailing list