ruby - QtRuby: Stack Level too deep (SystemStackError) -


i have following code:

require 'qt'  class menu < qt::widget   slots 'on_clicked_uauth()'   slots 'quit()'    def initialize(parent = nil)     super(parent)     setwindowtitle "menu"     uauth_ui     exit_ui     resize 350, 500     move 300, 300     show   end   def uauth_ui     uauth = qt::pushbutton.new 'auth', self     uauth.resize 150, 35     uauth.move 100, 100     connect uauth, signal('clicked()'), self, slot('on_clicked_uauth()')   end   def exit_ui     exit = qt::pushbutton.new 'exit', self     exit.resize 120, 40     exit.move 115, 420     connect exit, signal('clicked()'), self, slot('quit()')   end end  app = qt::application.new(argv) menu.new app.exec 

when click either button, following error:

stack level deep (systemstackerror) 

can let me know changes should make that, when click buttons, next screen?

first of all, had change require 'qt' require 'qt' on system, because use case-sensitive filesystem , because of compatibility reasons recommend using correct case.

once able run script realized stack trace systemstackerror message provided. looked bit around , found useful snippet here: (apparently don't need in ruby 2.2 anymore don't have installed right didn't bother trying out)

set_trace_func proc {   |event, file, line, id, binding, classname|    if event == "call"  && caller_locations.length > 500     fail "stack level deep"   end } 

you add somewhere before executing app , stack trace more useful:

from /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:2531:in `debug_level' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:2714:in `do_method_missing' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:2711:in `do_method_missing' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:2667:in `do_method_missing' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `method_missing' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `qt_metacall' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `method_missing' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `qt_metacall' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `method_missing' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `qt_metacall' /usr/lib/ruby/vendor_ruby/2.1.0/qt/qtruby4.rb:469:in `method_missing' 

so somehow got stuck in endless loop of calling method not present (therefore stack level ends being deep).

now wasn't able fix issue, seems method missing. can't see declaration of on_clicked_uauth() anywhere , i'm not sure either if quit() can accessed slot that.

update: i'm pretty issue slot invocation. example works fine:

connect(exit, signal(:clicked)) { puts "hello world." } 

now problem here quit not implemented on qtwidget rather on application. can close window , application terminate default if there no more windows open:

connect(exit, signal(:clicked)) { close() } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -