Warning from FXRuby

View: New views
4 Messages — Rating Filter:   Alert me  

Warning from FXRuby

by David Toll :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have the following program, named hello.rb (you may recognise this - it is on page 15 of the FXRuby book):

      require 'fox16'
      app = Fox::FXApp.new
      main = Fox::FXMainWindow.new(app, "Hello World", :width => 200, :height => 100)
      app.create
      main.show(Fox::PLACEMENT_SCREEN)
      app.run


When I run this on Red Hat EnterPrise Linux 5.3, 64-bit, with Ruby 1.9.1, FXRuby 1.16.19 and FOX 1.6.36, I get the following warnings:


      [toll@localhost ~]$ ruby -w hello.rb
      /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/lib/fox16/core.rb:209: warning: mismatched indentations at 'end' with 'def' at 207
      /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/lib/fox16/core.rb:210: warning: mismatched indentations at 'end' with 'class' at 205
      [toll@localhost ~]$


The offending code (lines 205-209 of core.rb) is:


      class FXScrollArea
        # Returns a reference to the scroll corner (an FXScrollCorner instance) for this window.
        def scrollCorner
          verticalScrollBar.next
        end
      end

Note that I do not get these warnings with Ruby 1.8.6-111, FXRuby 1.16.16 under Windows XP.

On the Linux system, I installed FOX and Ruby by downloading the tarball sources, and compiling them.  The FXRuby was then installed using gem install fxruby --remote, as shown on page 25 of the FXRuby book.


        Dave
____________________________________________________________
David C. Toll, Research Staff Member
IBM T. J. Watson Research Center, 19 Skyline Drive, Hawthorne NY 10532
Phone: 914-784-7019 (t/l 863)   Fax: 914-784-6205 (t/l 863)  email: toll@...

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Warning from FXRuby

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the information, David. Yes, it looks like for whatever reason I've got a weird combination of tabs and spaces for the indentation in that part of the file; that can be easily fixed. Since they are just warnings, you can presumably ignore them until I get a patched version out. Looks like Ruby 1.9.1 is more picky about indentation, which is kind of an interesting change...

I'm also glad to see that it (apparently?) built without any problems. I don't think a lot of folks are playing with Ruby 1.9.1 yet, much less trying FXRuby with it. I know that I'm still seeing a few unusual things with FXRuby under Ruby 1.9.1, so please let me know what you observe.

Thanks,

Lyle

On Apr 16, 2009, at 1:51 PM, David Toll wrote:


I have the following program, named hello.rb (you may recognise this - it is on page 15 of the FXRuby book):

      require 'fox16'
      app = Fox::FXApp.new
      main = Fox::FXMainWindow.new(app, "Hello World", :width => 200, :height => 100)
      app.create
      main.show(Fox::PLACEMENT_SCREEN)
      app.run


When I run this on Red Hat EnterPrise Linux 5.3, 64-bit, with Ruby 1.9.1, FXRuby 1.16.19 and FOX 1.6.36, I get the following warnings:


      [toll@localhost ~]$ ruby -w hello.rb
      /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/lib/fox16/core.rb:209: warning: mismatched indentations at 'end' with 'def' at 207
      /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/lib/fox16/core.rb:210: warning: mismatched indentations at 'end' with 'class' at 205
      [toll@localhost ~]$


The offending code (lines 205-209 of core.rb) is:


      class FXScrollArea
        # Returns a reference to the scroll corner (an FXScrollCorner instance) for this window.
        def scrollCorner
          verticalScrollBar.next
        end
      end

Note that I do not get these warnings with Ruby 1.8.6-111, FXRuby 1.16.16 under Windows XP.

On the Linux system, I installed FOX and Ruby by downloading the tarball sources, and compiling them.  The FXRuby was then installed using gem install fxruby --remote, as shown on page 25 of the FXRuby book.


        Dave
____________________________________________________________
David C. Toll, Research Staff Member
IBM T. J. Watson Research Center, 19 Skyline Drive, Hawthorne NY 10532
Phone: 914-784-7019 (t/l 863)   Fax: 914-784-6205 (t/l 863)  email: toll@...
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users


_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

FXRuby Program Crashes

by David Toll :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


When I run this program:


require 'fox16'
include Fox

class ModelWindow < FXMainWindow

  #  The default height and width of the main window, in pixels

  WINDOW_HEIGHT =  800
  WINDOW_WIDTH  = 1000
  WINDOW_X = 80
  WINDOW_Y = 110


  def create
    super
    show
  end  #  of method create


  def initialize(app, titleString)

    #  Create the main window

    super(app, titleString, :x      => WINDOW_X,
                            :y      => WINDOW_Y,
                            :width  => WINDOW_WIDTH,
                            :height => WINDOW_HEIGHT)

    #  Terminate the program when the main window is closed.  If we omit this,
    #  then closing the window results in a return to the "main" program in
    #  WSCI_Model.rb

    self.connect(SEL_CLOSE) do
      exit(0)
    end

    #  Split the main window into two panes, the left and right panes, and
    #  then in each pane create a frame that allows us to create windows
    #  vertically (i.e. above one another).

    splitter = FXSplitter.new(self, :opts => SPLITTER_HORIZONTAL|LAYOUT_FILL)
    @left  = FXVerticalFrame.new(splitter,
                                 :width  => WINDOW_WIDTH/2,
                                 :opts => LAYOUT_TOP|
                                          LAYOUT_FIX_WIDTH|
                                          LAYOUT_FILL_Y|
                                          FRAME_SUNKEN)
    @right = FXVerticalFrame.new(splitter,
                                 :opts => LAYOUT_TOP|LAYOUT_FILL|FRAME_SUNKEN)

    leftSplit = FXSplitter.new(@left, :opts => SPLITTER_VERTICAL|LAYOUT_FILL)
    leftTop = FXVerticalFrame.new(leftSplit,
                                  :height => (WINDOW_HEIGHT*7)/10,
                                  :opts => LAYOUT_TOP|
                                           LAYOUT_FIX_HEIGHT|
                                           LAYOUT_FILL_X|
                                           FRAME_SUNKEN)
    @leftBottom = FXVerticalFrame.new(leftSplit,
                                      :opts => LAYOUT_BOTTOM|
                                               LAYOUT_FILL_X|
                                               FRAME_SUNKEN)

    #  In the top pane, create the main text output (console) window.  We do
    #  not specify WORDWRAP - the text is then scrollable sideways.

    $mainText = FXText.new(leftTop,
                           :opts => LAYOUT_FILL|
                                    TEXT_READONLY|
                                    FRAME_NONE)

    #  Create the command area and button in the lower left-hand pane

    commandGroup = FXGroupBox.new(@leftBottom,
                                  "Command:",
                                  :opts => LAYOUT_FILL_X|
                                           GROUPBOX_TITLE_CENTER|
                                           FRAME_RIDGE)

    #  Now a vertical frame

    commandVert = FXVerticalFrame.new(commandGroup, :opts => LAYOUT_FILL_X|FRAME_NONE)
  end  #  of method initialize


end  #  of Class ModelWindow

#-------------------------------------------------------------------------------

$fxApp = FXApp.new
$ModelWindow = ModelWindow.new($fxApp, "Test")

$fxApp.create
$fxApp.run

exit(0)


on Red Hat EnterPrise Linux 5.3, 64-bit, with Ruby 1.9.1, FXRuby 1.16.19 and FOX 1.6.36, when I close the window (by clicking on the "X" in the top rh corner), Ruby crashes.  Here is the log from the Linux terminal window:

ruby -w test.rb
/usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/lib/fox16/core.rb:209: warning: mismatched indentations at 'end' with 'def' at 207
/usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/lib/fox16/core.rb:210: warning: mismatched indentations at 'end' with 'class' at 205
<main>: [BUG] Segmentation fault
ruby 1.9.1p0 (2009-01-30 revision 21907) [x86_64-linux]

-- control frame ----------
c:0001 p:0000 s:0002 b:0002 l:000e78 d:000e78 TOP
---------------------------
-- Ruby level backtrace information-----------------------------------------

-- C level backtrace information -------------------------------------------
0x4d6491 ruby(rb_vm_bugreport+0x41) [0x4d6491]
0x500f9e ruby [0x500f9e]
0x501101 ruby(rb_bug+0xb1) [0x501101]
0x48b47f ruby [0x48b47f]
0x395b20e4c0 /lib64/libpthread.so.0 [0x395b20e4c0]
0x4909f6 ruby(st_lookup+0x26) [0x4909f6]
0x4c6815 ruby [0x4c6815]
0x4c6863 ruby(rb_get_method_body+0x23) [0x4c6863]
0x4d26ea ruby(rb_funcall+0x17a) [0x4d26ea]
0x2aaaab40ab81 /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/ext/fox16/fox16.so(_Z18FXRbCallVoidMethodPN2FX8FXObjectEm+0x5d) [0x2aaaab40ab81]
0x2aaaab1eceb8 /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/ext/fox16/fox16.so(_ZN12FXRbGroupBox6recalcEv+0x40) [0x2aaaab1eceb8]
0x2aaaabbd3e5d /usr/local/lib/libFOX-1.6.so.0(_ZN2FX8FXWindowD2Ev+0x13d) [0x2aaaabbd3e5d]
0x2aaaab41f3c3 /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/ext/fox16/fox16.so(_ZN2FX8FXPackerD2Ev+0x27) [0x2aaaab41f3c3]
0x2aaaab41f5a3 /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/ext/fox16/fox16.so(_ZN2FX15FXVerticalFrameD2Ev+0x27) [0x2aaaab41f5a3]
0x2aaaab428e49 /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/ext/fox16/fox16.so(_ZN17FXRbVerticalFrameD0Ev+0x39) [0x2aaaab428e49]
0x2aaaab4a4dac /usr/local/lib/ruby/gems/1.9.1/gems/fxruby-1.6.19/ext/fox16/fox16.so(_ZN10FXRbObject8freefuncEPN2FX8FXObjectE+0xf4) [0x2aaaab4a4dac]
0x41b777 ruby [0x41b777]
0x41b8ff ruby [0x41b8ff]
0x41bac4 ruby(rb_gc_call_finalizer_at_exit+0x174) [0x41bac4]
0x417c07 ruby(ruby_cleanup+0x147) [0x417c07]
0x417d5a ruby(ruby_run_node+0x3a) [0x417d5a]
0x4154cd ruby(main+0x4d) [0x4154cd]
0x395a61d974 /lib64/libc.so.6(__libc_start_main+0xf4) [0x395a61d974]
0x4153c9 ruby [0x4153c9]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted
[toll@localhost Emu_Test]$

I have cut the program down as far as I can - if you remove almost anything else, it no longer crashes).

Do you have any idea if this is a problem in FXRuby with Ruby 1.9.1?  Is this a problem with my 64-bit Linux installation (i.e. did I get the installation wrong somehow)?  Or, as the log suggests, is this a bug in Ruby 1.9.1?

Note that this does NOT crash on 32-bit ruby 1.8.6 under Windows XP.

        Thanks
                Dave

____________________________________________________________
David C. Toll, Research Staff Member
IBM T. J. Watson Research Center, 19 Skyline Drive, Hawthorne NY 10532
Phone: 914-784-7019 (t/l 863)   Fax: 914-784-6205 (t/l 863)  email: toll@...

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: FXRuby Program Crashes

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Apr 17, 2009, at 12:30 PM, David Toll wrote:

I have cut the program down as far as I can - if you remove almost anything else, it no longer crashes).

Do you have any idea if this is a problem in FXRuby with Ruby 1.9.1?  Is this a problem with my 64-bit Linux installation (i.e. did I get the installation wrong somehow)?  Or, as the log suggests, is this a bug in Ruby 1.9.1?

I am seeing a lot of this. I would classify it as a problem with FXRuby on Ruby 1.9.1, although it's due to a change (or changes?) in the garbage collection implementation for Ruby 1.9.1.

I am not sure what it's going to take to fix it at this point, but patches are welcome from anyone who has more time to look at this than I do at the moment.

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users