The following two problems occur on Windows and Linux, with ruby-1.8.2 and FXRuby-1.2.5. Instead of FXTableItems, (some of) the items of a table are FXHeaderItems. A memory problem (all I know is GC.disable seems to prevent it). The code is below. ---- require "fox12" include Fox class MyTable < FXTable def initialize parent super(parent, nil, 0, TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y) fill end def fill setTableSize(100, 100) each_row_header_item do |item| item.setJustify FXHeaderItem::CENTER_Y end each_col_header_item do |item| item.setJustify FXHeaderItem::CENTER_X end each_row_index do |r| each_col_index do |c| item = table_item(r,c) item.setJustify FXTableItem::JUSTIFY_CENTER_X if item.class != Fox::FXTableItem p ["fill", r,c,item.class] end end end setCurrentItem(0,0) columnHeader.update rowHeader.update update end def each_row_index (0...numRows).each do |r| yield r end end def each_col_index (0...numColumns).each do |c| yield c end end def each_row_header_item each_row_index do |r| yield row_header_item(r) end end def each_col_header_item each_col_index do |c| yield col_header_item(c) end end def row_header_item(row) rowHeader.getItem(row) end def col_header_item(col) columnHeader.getItem(col) end def table_item(row, col) # getItem(row, col) || create_item(row, col) if (item = getItem(row, col)) if item.class != Fox::FXTableItem p ["getItem", row,col,item.class] end else item = create_item(row, col) end item end def create_item(row, col) setItemText(row, col, "") item = getItem(row, col) if item.class != Fox::FXTableItem p ["create_item", row,col,item.class] end item end end class TestWindow < FXMainWindow 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) bugButton = FXButton.new(mainFrame, "Bug") bugButton.connect(SEL_COMMAND) { @table.fill } @table = MyTable.new(mainFrame) 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
Joel VanderWerf wrote:> > The following two problems occur on Windows and Linux, with ruby-1.8.2 > and FXRuby-1.2.5. > > Instead of FXTableItems, (some of) the items of a table are FXHeaderItems.Odd. Some debugging code shows that FXTable#createItem sometimes returns a FXHeaderItem. On linux there''s usually one of these per 100x100 table, as I fill it with items. On windows there seem to be more.
On Mar 7, 2005, at 7:57 PM, Joel VanderWerf wrote:> > The following two problems occur on Windows and Linux, with ruby-1.8.2 > and FXRuby-1.2.5. > > Instead of FXTableItems, (some of) the items of a table are > FXHeaderItems. > > A memory problem (all I know is GC.disable seems to prevent it). > > The code is below.Thanks, Joel. I''ve added this to the bug list and will get to it ASAP.
Dunno if this is related, but the same app (my app, not the test case) just gave me the following, during FXMessageBox.error(): include/FXRuby.h:373: FXASSERT(!NIL_P(obj)) failed. include/FXRuby.h:373: FXASSERT(!NIL_P(obj)) failed. /home/vjoel/path/ids/prj/eval-tool/lib/eval-tool1/gui/FXWindow-ext.rb:74:in `drawCell'': NoMethodError: undefined method `draw'' for nil:NilClass from /home/vjoel/path/ids/prj/eval-tool/lib/eval-tool1/gui/FXWindow-ext.rb:74:in `drawRange'' from /home/vjoel/path/ids/prj/eval-tool/lib/eval-tool1/gui/FXWindow-ext.rb:74:in `drawContents'' from /home/vjoel/path/ids/prj/eval-tool/lib/eval-tool1/gui/FXWindow-ext.rb:74:in `error'' ... It may just be fallout from the same source of corruption. This part of the code (invocation of #error()) normally works fine. Sorry for the paltry information...
Joel VanderWerf wrote:> > The following two problems occur on Windows and Linux, with ruby-1.8.2 > and FXRuby-1.2.5. > > Instead of FXTableItems, (some of) the items of a table are FXHeaderItems. > > A memory problem (all I know is GC.disable seems to prevent it).Time for the wheel to squeak a bit... I''ve got a new problem, I think. I''ve worked around above problems, at least on linux, by precreating my table items to make sure they are really FXTableItems. But I still get memory problems (probably dangling pointers left after GC) on windows only. It will take some effort to isolate the problem to a small test case, but before I do that, it would be nice to make sure it really is a different problem. Lyle, any chance of a fix for the reported problems, so I can proceed with this isolation task? Thanks.