Seg Fault when trying to display a QMessageBox



  • OS is Ubuntu 10.10 amd64 and QT 4.7 SDK installed. My app is trying to display a message box but fails with a seg fault if I change the default theme in Ubuntu from Ambiance to Clearlooks. Works fine using Ambiance. Any ideas on how to fix this?
    output from terminal:
    (<unknown>:2076): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure

    (<unknown>:2076): Gtk-WARNING **: Error loading theme icon 'dialog-error' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure

    (<unknown>:2076): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

    ** (<unknown>:2076): CRITICAL **: clearlooks_style_draw_render_icon: assertion `base_pixbuf != NULL' failed

    (<unknown>:2076): Gtk-CRITICAL **: IA__gtk_style_render_icon: assertion `pixbuf != NULL' failed

    (<unknown>:2076): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_pixels: assertion `GDK_IS_PIXBUF (pixbuf)' failed

    (<unknown>:2076): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_width: assertion `GDK_IS_PIXBUF (pixbuf)' failed

    (<unknown>:2076): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_height: assertion `GDK_IS_PIXBUF (pixbuf)' failed

    Program received signal SIGSEGV, Segmentation fault.



  • Have you installed qt sdk 2010.05.1 or 2010.05? Because the second give me the error message you posted!



  • can you post your code?

    The messages you post are from GTK/GDK. Qt shouldn't use them.



  • Yes I installed qt-sdk-linux-x86_64-opensource-2010.05.1.bin.

    Here's the code:
    @
    QMessageBox::critical(0, qApp->tr("Cannot open database"),
    qApp->tr("Unable to establish a database connection.\n"
    "\n"
    "Click Cancel to exit."), QMessageBox::Cancel);
    @

    Here's the backtrace:

    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff73c3421 in QGtkPainter::getIcon(char const*, GtkIconSize) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    (gdb) backtrace full
    #0 0x00007ffff73c3421 in QGtkPainter::getIcon(char const*, GtkIconSize) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #1 0x00007ffff73b26f2 in QGtkStyle::standardIconImplementation(QStyle::StandardPixmap, QStyleOption const*, QWidget const*) const () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #2 0x00007ffff77032c3 in QGtkStyle::qt_metacall(QMetaObject::Call, int, void**) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #3 0x00007ffff6a8adcd in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtCore.so.4
    No symbol table info available.
    #4 0x00007ffff6a8cb26 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtCore.so.4
    No symbol table info available.
    #5 0x00007ffff7327041 in QStyle::standardIcon(QStyle::StandardPixmap, QStyleOption const*, QWidget const*) const () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #6 0x00007ffff7543a5f in QMessageBoxPrivate::standardIcon(QMessageBox::Icon, QMessageBox*) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #7 0x00007ffff754507d in QMessageBox::setIcon(QMessageBox::Icon) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #8 0x00007ffff7546460 in QMessageBox::QMessageBox(QMessageBox::Icon, QString const&, QString const&, QFlagsQMessageBox::StandardButton, QWidget*, QFlagsQt::WindowType) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #9 0x00007ffff75469b8 in showNewMessageBox(QWidget*, QMessageBox::Icon, QString const&, QString const&, QFlagsQMessageBox::StandardButton, QMessageBox::StandardButton) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #10 0x00007ffff7546b2f in QMessageBox::critical(QWidget*, QString const&, QString const&, QFlagsQMessageBox::StandardButton, QMessageBox::StandardButton) () from /home/tonyl/dev/Mtran-build-desktop/lib/libQtGui.so.4
    No symbol table info available.
    #11 0x00000000004118d1 in createDbConnection (db=...) at ../Mtran/db.cpp:38
    No locals.
    #12 0x000000000040b9c4 in MainWindow::createConnection (this=0x7fffffffe1d0) at ../Mtran/mainwindow.cpp:459
    rtn = false

    [edit: code markup / chetankjain]



  • Try to set this as QMEssageBox's parent, i.e. pass it as the first parameter.

    @QMessageBox::critical(this, qApp->tr("Cannot open database"),
    qApp->tr("Unable to establish a database connection.\n"
    "\n"
    "Click Cancel to exit."), QMessageBox::Cancel);@



  • [quote author="lyuts" date="1287664731"]Try to set this as QMEssageBox's parent, i.e. pass it as the first parameter.
    [/quote]

    it works with 0 parent in winxp, not sure if that could be a problem on linux


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.