[Kde-bindings] crash when using a KDE::PageDialog without Application#exec

Richard Dale rdale at foton.es
Mon Aug 25 11:26:14 UTC 2008


On Saturday 23 August 2008 21:09:59 Stefano Crocco wrote:
> In korundum4, adding a KDE::PageWidgetItem to a KDE::PageDialog seems to
> cause a crash if KDE::Application#exec isn't called before the end of the
> program. Here's a program which displays this behavior:
>
> require 'korundum4'
> data = KDE::AboutData.new "test", "", KDE::ki18n("test"), "0.0.1"
> KDE::CmdLineArgs.init [], data
> app = KDE::Application.new
> dlg = KDE::PageDialog.new
> w = Qt::Label.new "TEST"
> it = KDE::PageWidgetItem.new w
> dlg.add_page it
> puts "created"
>
> The crash happens after the end of the program (the puts is executed) and
> disappears if I add the line
>
> dlg.show
> app.exec
>
> at the end.
>
> I don't know whether this is a bug or a known limitation of korundum (an
> analogous program written in C++ works correctly). Here's the related
> backtrace, but I'm not sure it will be useful (the KDE Crash Handler says
> it won't, but I have compiled everything with the debug flags on, so I
> don't know why).
>
> #0  0x082d9bc8 in ?? ()
> #1  0xb7574dd3 in ~PageItem (this=0x82cd490) at /var/tmp/paludis/kde-base-
> kdelibs-scm/work/kdelibs-scm/kdeui/paged/kpagewidgetmodel.cpp:174
> #2  0xb7574e05 in ~PageItem (this=0x82d5008) at
> /usr/include/qt4/QtCore/qalgorithms.h:352
> #3  0xb7575cd0 in ~KPageWidgetModelPrivate (this=0x82d4ff0) at
> /var/tmp/paludis/kde-base-kdelibs-scm/work/kdelibs-
> scm/kdeui/paged/kpagewidgetmodel_p.h:66
> #4  0xb756e5d6 in ~KPageModel (this=0x82d4fd8) at
> /var/tmp/paludis/kde-base-
> kdelibs-scm/work/kdelibs-scm/kdeui/paged/kpagemodel.cpp:42
> #5  0xb7574501 in ~KPageWidgetModel (this=0x82d4fd8) at
> /var/tmp/paludis/kde-
> base-kdelibs-scm/work/kdelibs-scm/kdeui/paged/kpagewidgetmodel.cpp:261 #6 
> 0xb6924934 in QObjectPrivate::deleteChildren (this=0x82d3958) at
> kernel/qobject.cpp:1860
> #7  0xb60e4fa2 in ~QWidget (this=0x82d27c8) at kernel/qwidget.cpp:1341
> #8  0xb756ef66 in ~KPageView (this=0x82d27c8) at /var/tmp/paludis/kde-base-
> kdelibs-scm/work/kdelibs-scm/kdeui/paged/kpageview.cpp:315
> #9  0xb75739ad in ~KPageWidget (this=0x82d27c8) at
> /var/tmp/paludis/kde-base-
> kdelibs-scm/work/kdelibs-scm/kdeui/paged/kpagewidget.cpp:78
> #10 0xb6924934 in QObjectPrivate::deleteChildren (this=0x82cf9b0) at
> kernel/qobject.cpp:1860
> #11 0xb60e4fa2 in ~QWidget (this=0x82cf8c0) at kernel/qwidget.cpp:1341
> #12 0xb64b5b68 in ~QDialog (this=0x82cf8c0) at dialogs/qdialog.cpp:300
> #13 0xb74b6be8 in ~KDialog (this=0x82cf8c0) at /var/tmp/paludis/kde-base-
> kdelibs-scm/work/kdelibs-scm/kdeui/dialogs/kdialog.cpp:192
> #14 0xb756d9b3 in ~KPageDialog (this=0x82cf8c0) at
> /var/tmp/paludis/kde-base-
> kdelibs-scm/work/kdelibs-scm/kdeui/paged/kpagedialog.cpp:66
> #15 0xb7a6dea8 in ~x_KPageDialog (this=0x82cf8c0) at
> /home/stefano/temp/kdebindings/build/smoke/kde/x_12.cpp:3702
> #16 0xb7a5f4b2 in xcall_KPageDialog (xi=<value optimized out>,
> obj=0x82cf8c0, args=0xbfbb9278) at
> /home/stefano/temp/kdebindings/build/smoke/kde/x_12.cpp:3736
> #17 0xb70943d3 in smokeruby_free (p=0x82cb500) at
> /home/stefano/temp/kdebindings/ruby/qtruby/src/handlers.cpp:359
> #18 0xb7f0cfec in rb_gc_call_finalizer_at_exit () from
> /usr/lib/libruby18.so.1.8
> #19 0xb7ef3b05 in ruby_finalize_1 () from /usr/lib/libruby18.so.1.8
> #20 0xb7eff7ee in ruby_cleanup () from /usr/lib/libruby18.so.1.8
> #21 0xb7eff901 in ruby_stop () from /usr/lib/libruby18.so.1.8
> #22 0xb7f065ba in ruby_run () from /usr/lib/libruby18.so.1.8
> #23 0x080487a5 in main ()
In app.exec a flag gets set when the app terminates, to stop Ruby from 
deleting everything. So you could add this to the end of your script, but 
it's a bit ugly as it isn't really supposed to be in the public api:

Qt::Internal.application_terminated = true

Maybe there is better way of trapping when a qtruby or korundum script exits, 
but I can't think of one.

-- Richard



More information about the Kde-bindings mailing list