[Kde-bindings] some issues with korundum4

Stefano Crocco stefano.crocco at alice.it
Thu Jul 10 08:04:54 UTC 2008


I'm having some issues with korundum4. Here they are (if you'd prefer I wrote
a separate mail for each issue, please let me know):

1) I am unable to correctly override the initialize method for Qt::Application
from a subclass. The following code, which I think should work, gives an 
error:

require 'Qt4'

class App < Qt::Application

  def initialize argv
    super(argv)
  end

end

a = App.new []

The error message is:

/usr/lib/ruby/site_ruby/1.8/Qt/qtruby4.rb:2435:in `initialize': wrong number of arguments (2 for 1) (ArgumentError)
        from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby4.rb:2435:in `call'
        from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby4.rb:2435:in `try_initialize'
        from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby4.rb:2434:in `catch'
        from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby4.rb:2434:in `try_initialize'
        from ./prova.rb:21:in `new'
        from ./prova.rb:21

I may be doing something wrong, but I can't find out what.

2) It seems that the KTextEditor module doesn't work correctly. I create an
instance of KTextEditor::Document using the following code:

require 'korundum4'
require 'ktexteditor'

data = KDE::AboutData.new "test", "", KDE::ki18n("test"), "0.0.1"
KDE::CmdLineArgs.init [], data

app = KDE::Application.new
w = KParts::MainWindow.new nil, 0
ed = KTextEditor::EditorChooser.editor 'katepart'
doc = ed.create_document w

After this, the line

puts doc.text

causes a segmentation fault with the following backtrace:

#0  0xb78b5d88 in QString::toLatin1 () from /usr/lib/qt4/libQtCore.so.4
#1  0xb5db3612 in rstringFromQString (s=0xb7efb178) at /home/stefano/temp/kdebindings/ruby/qtruby/src/handlers.cpp:882
#2  0xb5db3973 in marshall_QString (m=0xbf9889cc) at /home/stefano/temp/kdebindings/ruby/qtruby/src/handlers.cpp:920
#3  0xb5ddd0cb in MethodReturnValue (this=0xbf9889cc, smoke=0x81dacc0, meth=<value optimized out>, stack=0x8373c80, retval=0xbf988b30)
    at /home/stefano/temp/kdebindings/ruby/qtruby/src/marshall_types.cpp:396
#4  0xb5ddf6df in MethodCall::callMethod (this=0xbf988b00) at /home/stefano/temp/kdebindings/ruby/qtruby/src/marshall_types.h:161
#5  0xb5ddd008 in MethodCallBase::next (this=0xbf988b00) at /home/stefano/temp/kdebindings/ruby/qtruby/src/marshall_types.cpp:457
#6  0xb5daa879 in method_missing (argc=1, argv=0xbf988f00, self=3045416300) at /home/stefano/temp/kdebindings/ruby/qtruby/src/Qt.cpp:886
#7  0xb7fc0985 in call_cfunc () from /usr/lib/libruby18.so.1.8
#8  0xb7fcb3e5 in rb_call0 () from /usr/lib/libruby18.so.1.8
#9  0xb7fcb571 in rb_call () from /usr/lib/libruby18.so.1.8
#10 0xb7fcbe4d in rb_funcall2 () from /usr/lib/libruby18.so.1.8
#11 0xb7fd162e in method_missing () from /usr/lib/libruby18.so.1.8
#12 0xb7fcb663 in rb_call () from /usr/lib/libruby18.so.1.8
#13 0xb7fc5eb8 in rb_eval () from /usr/lib/libruby18.so.1.8
#14 0xb7fc8612 in rb_eval () from /usr/lib/libruby18.so.1.8
#15 0xb7fd6b9b in ruby_exec_internal () from /usr/lib/libruby18.so.1.8
#16 0xb7fd6bdb in ruby_exec () from /usr/lib/libruby18.so.1.8
#17 0xb7fd6c10 in ruby_run () from /usr/lib/libruby18.so.1.8
#18 0x08048715 in main ()

Also, the line

doc.create_view

returns nil instead of a new view.

3) Using KDE::ConfigSkeleton with an item of type Url causes a crash. Here's
a piece of code which causes this behavior (here I added the item manually,
but the same happens when using a kcfg file and rbkconfig_compiler4):

require 'korundum4'
data = KDE::AboutData.new "test", "", KDE::ki18n("test"), "0.0.1"
KDE::CmdLineArgs.init [], data

app = KDE::Application.new
sk = KDE::ConfigSkeleton.new
value = Qt::Variant.fromValue KDE::Url.new
it = KDE::ConfigSkeleton::ItemUrl.new "test", "Test url", value, KDE::Url.from_path( 'http://www.kde.org')
sk.add_item it

This is the corresponding backtrace:
#0  0xb7904afd in QUrl::QUrl () from /usr/lib/qt4/libQtCore.so.4
#1  0xb7653a1b in KUrl (this=0x8342150, _u=@0x8341ae0) at /var/tmp/paludis/kde-base-kdelibs-scm/work/kdelibs-scm/kdecore/io/kurl.cpp:431
#2  0xb7c5edf1 in new_kconfigskeleton_item<KCoreConfigSkeleton::ItemUrl, KUrl, ((const char*)((char*)(&<unnamed>::itemurlSTR)))> (argc=4, argv=0xbfe7f9d0, self=<value optimized out>)
    at /home/stefano/temp/kdebindings/ruby/korundum/src/Korundum.cpp:336
#3  0xb7fb8985 in call_cfunc () from /usr/lib/libruby18.so.1.8
#4  0xb7fc33e5 in rb_call0 () from /usr/lib/libruby18.so.1.8
#5  0xb7fcbe3d in method_call () from /usr/lib/libruby18.so.1.8
#6  0xb7fb8985 in call_cfunc () from /usr/lib/libruby18.so.1.8
#7  0xb7fc33e5 in rb_call0 () from /usr/lib/libruby18.so.1.8
#8  0xb7fc3571 in rb_call () from /usr/lib/libruby18.so.1.8
#9  0xb7fbdeb8 in rb_eval () from /usr/lib/libruby18.so.1.8
#10 0xb7fc1ae0 in rb_yield_0 () from /usr/lib/libruby18.so.1.8
#11 0xb7fcc534 in rb_f_catch () from /usr/lib/libruby18.so.1.8
#12 0xb7fb895b in call_cfunc () from /usr/lib/libruby18.so.1.8
#13 0xb7fc33e5 in rb_call0 () from /usr/lib/libruby18.so.1.8
#14 0xb7fc3571 in rb_call () from /usr/lib/libruby18.so.1.8
#15 0xb7fbdfe3 in rb_eval () from /usr/lib/libruby18.so.1.8
#16 0xb7fc1245 in rb_eval () from /usr/lib/libruby18.so.1.8
#17 0xb7fc3313 in rb_call0 () from /usr/lib/libruby18.so.1.8
#18 0xb7fc3571 in rb_call () from /usr/lib/libruby18.so.1.8
#19 0xb7fc3e4d in rb_funcall2 () from /usr/lib/libruby18.so.1.8
#20 0xb77a8b26 in new_qt (argc=4, argv=0xbfe81530, klass=3084412380) at /home/stefano/temp/kdebindings/ruby/qtruby/src/qtruby.cpp:1004
#21 0xb7fb8985 in call_cfunc () from /usr/lib/libruby18.so.1.8
#22 0xb7fc33e5 in rb_call0 () from /usr/lib/libruby18.so.1.8
#23 0xb7fc3571 in rb_call () from /usr/lib/libruby18.so.1.8
#24 0xb7fbdeb8 in rb_eval () from /usr/lib/libruby18.so.1.8
#25 0xb7fbf051 in rb_eval () from /usr/lib/libruby18.so.1.8
#26 0xb7fceb9b in ruby_exec_internal () from /usr/lib/libruby18.so.1.8
#27 0xb7fcebdb in ruby_exec () from /usr/lib/libruby18.so.1.8
#28 0xb7fcec10 in ruby_run () from /usr/lib/libruby18.so.1.8
#29 0x08048715 in main ()

Replacing the line

value = Qt::Variant.fromValue KDE::Url.new

with 

value = Qt::Variant.fromValue Qt::Url.new

the crash disappears, but retreiving the option using the code

res = sk.findItem 'Test url'
url = res.property.to_url.path

gives nil. Using another kind of option, for example a
KDE::ConfigSkeleton::ItemInt works correctly.

Stefano



More information about the Kde-bindings mailing list