[fxruby-users] FXTable segfaults after multiple setTableSize calls

DeZonia, Barry bdezonia at wisc.edu
Fri Feb 18 16:54:16 EST 2005

The app fails for me too selecting either button (after 8-20 times).

Windows, Ruby 1.8.2-14 final, fxruby 1.2.2

-----Original Message-----
From: fxruby-users-bounces at rubyforge.org
[mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of David Peoples
Sent: Friday, February 18, 2005 3:39 PM
To: fxruby-users
Subject: [fxruby-users] FXTable segfaults after multiple setTableSize calls

When I empty and refill an FXTable multiple times with a large data set 
(10,000 rows x 1 column in the example below, around 1000 rows x 6 
columns in a more complicated app), the application eventually fails 
with a segmentation fault. The number of repetitions required to produce 
the segfault is rather random, ranging from just a couple reps to 15 or 
20 in some trials. The program disappears (window goes away) apparently 
during or just after the table is filled, leaving the following message 
at the command prompt:

C:/Data/Ruby/pos/stockviewertest/mainv5c.rb:21: [BUG] Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-mswin32]

The platform is Windows XP Home with service pack 2. The base Ruby 
installation is the "One Click Ruby Installer" version 1.8.2-14 final 
(ruby182-14.exe). I've installed FXRuby version 1.2.3 on top of the 
version included with the one click installer 
(FXRuby-1.2.3-ruby182.exe). fxversion() reports "1.2.13" from the irb 
command prompt. The machine has a Pentium 4 and 256mb ram.

If someone can run the example code below and it fails like I'm seeing, 
let me know. If you see an obvious programming error on my part, please 
tell me -- I'm new to Ruby and that's a serious possibility. If you can 
run the code on Windows and it *doesn't* fail, let me know that -- maybe 
it is some other problem on this machine I'll have to track down 
(display driver?).

Thanks for your help.

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 }

   # 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}")

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

   def create


def runme
   application = FXApp.new("MyTest", "FoxTest")



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

More information about the fxruby-users mailing list