FXRuby problems... segmentation fault

P

PATRICK FERNIE

I've been trying to code up a GUI for manipulating rather large CSV files using FXRuby (1.2.2) with FOX version 1.2.13, and ruby 1.8.2. My interface uses MDI documents, each child window of which contains a FXTabBook, with each Tab containing a FXTable that can be 20,000 items or more. The problem is, as I close MDIChild windows, and open new ones, I sometimes get a segfault. As a test, I took the example code distributed with FXRuby, mditest.rb, and modified it to behave somewhat like my code, and I get similar behaviour. Basically, I modified the createTestWindow method in mditest.rb to be as below. If I run this program, and then repeatedly close and open new windows (while this doesn't seem like "sensible" behaviour, the bug is prevalent enough to happen in normal operation, as well), I get a segfault. This seems to me like a dead memory area issue, but I'm not sure how to ensure that certain objects are destroyed before others with FXRuby. Any suggestions on what the pr
oblem might be, or what I might be able to do to further diagnose it?

def createTestWindow(x, y, w, h)
mdichild = FXMDIChild.new(@mdiclient, "Child", nil, nil,0, x, y, w, h)
scrollwindow = FXScrollWindow.new(mdichild, 0)
scrollwindow.verticalScrollBar.setLine(@font.fontHeight)
tbl = FXTable.new(scrollwindow, nil, 0, TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 2, 2, 2, 2)
tbl.setTableSize(200,200)
(0...200).each { |c|
tbl.setColumnText(c,c.to_s)
}
(0...200).each { |r|
tbl.setRowText(r,r.to_s)
}
(0...200).each { |r|
(0...200).each { |c|
tbl.setItemText(r,c,"#{r},#{c}")
}
}
mdichild
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top