Kirix Support Forums

Porting to Ruby with WxRuby/Stack level too deep error

Please post all general questions, comments, bug reports, and any other wxWebConnect feedback here.

Porting to Ruby with WxRuby/Stack level too deep error

Postby daniel syddall on Tue Jan 12, 2010 1:30 am

Hello,
I'm trying to port the wxWebControl control to Ruby, using the WxRuby 2 wrappers. I've managed to get part way there, but I'm having some issues that maybe someone could help out with.

I've managed to compile the wxWebControl into the WxRuby 2 library, and I can successfully initialize the XulRunner engine, but when I try to instantiate the wxWebControl, I am getting a stack level too deep error.

Here's my Ruby app code:

Code: Select all
class WebControlFrame < Wx::Frame
  def initialize(*args)
    super(nil, *args)
    puts "INIT: " + Wx::WebControl.init_engine("/usr/lib/xulrunner-1.9.1/").to_s
    panel = Wx::Panel.new(self)
    puts "NEW: " + (@web_control = Wx::WebControl.new(panel, -1, Wx::Point.new(0, 0), Wx::Size.new(800, 600))).inspect
    sizer = Wx::BoxSizer.new(Wx::HORIZONTAL);
    sizer.add(@web_control, 1, Wx::EXPAND);
    panel.sizer = sizer
    puts "OPEN_URI: " + @web_control.open_uri("http://www.kirix.com/labs").to_s;
    puts "END_INIT."
  end
  def on_init
  end
  def on_size
  end
end

class WebControlApp < Wx::App
  def on_init
    frame = WebControlFrame.new( :title => "WebControl demonstration",
                                 :pos => [ 50, 50 ],
                                 :size => [ 1024, 768 ] )
    frame.show
  end
end

WebControlApp.new.main_loop()


and here's what I get when I try to run it:


Code: Select all
$ env LD_LIBRARY_PATH=../../webconnect/webconnect/webconnect irb
irb(main):001:0> require 'samples/webconnect/web_control.rb'
Calling wxEntry, this=0xa433d00
Registering '@mozilla.org/module-loader/python;1' (libpyloader.so)
Registering '@mozilla.org/network/protocol/about;1?what=python' (pyabout.py)
INIT: true
NEW: #<Wx::WebControl:0xb56943e8>
OPEN_URI:
END_INIT.
SystemStackError: stack level too deep
        from ./samples/webconnect/web_control.rb:26:in `is_shown'
        from ./samples/webconnect/web_control.rb:26:in `calc_min'
        from ./samples/webconnect/web_control.rb:26:in `layout'
        from ./samples/webconnect/web_control.rb:26:in `process_event'
        from ./samples/webconnect/web_control.rb:26:in `show'
        from ./samples/webconnect/web_control.rb:26:in `on_init'
        from ./samples/webconnect/web_control.rb:30:in `main_loop'
        from ./samples/webconnect/web_control.rb:30
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from (irb):1


The stack error occurs after the WxFrame has initialized, i.e. it seems to be occurring while the frame is determining its layout, perhaps.

I'd be very grateful if you could provide any information on what might be causing this.

Thanks,
Daniel
daniel syddall
Registered User
 
Posts: 1
Joined: Tue Jan 12, 2010 1:10 am

Return to wxWebConnect Questions, Thoughts & Feedback