SEGFAULT on QBasicAtomicInt::ref() in a basic program
-
Hello.
I'm new to Qt.
I tried to build a simple test program on an ARM9 processor : a window and a button to show a message box.
I launch the app in server mode (-qws parameter at command line).When the application exits it crashs with segmentation fault.
When I try to push the button the message appears and it crashs right after or when I press the button and it closes.
It's the same if I close the app (with the cross on the right top). But it seems to crash in another program section.This is the backtrace log. It seems to crash at the QBasicAtomicInt::ref() function.
Version of QT : 4.6.3 compiled for ARM9
config line : ./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian -no-webkit -no-qt3support -no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -qt-sql-sqlite -no-3dnow -system-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-opengl -gtkstyle -no-openvg -no-xshape -no-xsync -no-xrandr -qt-freetype -qt-gfx-linuxfb -qt-kbd-tty -qt-kbd-linuxinput -qt-mouse-tslib -qt-mouse-linuxinputIDE : QtCreator 2.4.1
GCC : 4.4.3main.cpp sample####
@int main(int argc, char *argv[])
{
QApplication app(argc, argv);MainWindow mainWindow; mainWindow.setOrientation(MainWindow::ScreenOrientationAuto); mainWindow.showExpanded(); return app.exec();
}
@mainwindow.cpp sample
@
MainWindow::MainWindow(QWidget parent)
: QMainWindow(parent, Qt::Window), ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
...
void MainWindow::on_pushButton_clicked()
{
this->box = new QMessageBox(this); / Without the "this" parameter it crashs without showing the message box. */
box->setText("buffer");
box->exec();
}
@Backtrace
@Thread 1 (Thread 764):
#0 0x403d2668 in QBasicAtomicInt::ref() () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#1 0x405d2e98 in QBrush::operator=(QBrush const&) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#2 0x4065264c in QPenPrivate::QPenPrivate(QBrush const&, float, Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#3 0x40650c90 in QPen::QPen(QBrush const&, float, Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#4 0x406124ec in QPainter::initFrom(QWidget const*) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#5 0x406138a0 in QPainter::begin(QPaintDevice*) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#6 0x40612098 in QPainter::QPainter(QPaintDevice*) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#7 0x404c8c4c in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#8 0x40753fb0 in QWidgetBackingStore::sync() () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#9 0x40753260 in QWidgetBackingStore::sync(QWidget*, QRegion const&) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#10 0x404bf840 in QWidgetPrivate::syncBackingStore(QRegion const&) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#11 0x40757b90 in QWSWindowSurface::setClipRegion(QRegion const&) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#12 0x405071f4 in QETWidget::translateRegionEvent(QWSRegionEvent const*) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#13 0x405049ec in QApplication::qwsProcessEvent(QWSEvent*) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#14 0x4050f688 in QEventDispatcherQWS::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#15 0x4125e1b4 in QEventLoop::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/local/qt4.6.3/lib/libQtCore.so.4
No symbol table info available.
#16 0x4125e330 in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/local/qt4.6.3/lib/libQtCore.so.4
No symbol table info available.
#17 0x40b769f8 in QDialog::exec() () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#18 0x0000ae4c in MainWindow::on_pushButton_clicked (this=0xbef5fb54) at ../test2_arm/mainwindow.cpp:77
No locals.
#19 0x0000b7d4 in MainWindow::qt_metacall (this=0xbef5fb54, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbef5f1f0) at moc_mainwindow.cpp:72
No locals.
#20 0x41269b20 in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/local/qt4.6.3/lib/libQtCore.so.4
No symbol table info available.
#21 0x41281470 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/local/qt4.6.3/lib/libQtCore.so.4
No symbol table info available.
#22 0x40db6ca4 in QAbstractButton::clicked(bool) () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#23 0x40a0bafc in QAbstractButtonPrivate::emitClicked() () from /usr/local/qt4.6.3/lib/libQtGui.so.4
No symbol table info available.
#24 0x40a0ba84 in QAbstractButtonPrivate::click() () from /usr/local/qt4.6.3/lib/libQtGui.so.4(sorry too long)
@
End of Backtrace
I tried to check the assembly code but I don't understand assembly.
I hope the informations provided are sufficient. I can post the assembly code next time if necessary.I'm stuck since two days.
Any help would be much appreciated.
Thanks. -
Have you tried building a debug version of your libraries? That should give you more insightful information than the assembler code.
-
I didn't know I could build the shared libraries as debug.
I rebuild the Qt framework as debug then replace the compiled libraries in the board.
For debugging is the -g option in gcc correct ?What should I see next in the stacktrace ? (excepting assembly code).
Thanks for your previous answer and spending some time.
-
Typically in your ./configure command, you add -debug to build debug libraries.
-
Hello.
I finaly successed to install the debug libs. (I have not much space on built-in hardware).Well, now I can't launch my app anymore. I have a new error.
[code]
ASSERT: "cr < NColorRoles" in file kernel/qpalette.cpp, line 783
Aborted
[/code]I launched it with gdb too but now it seems to stop in /lib/libc.so.6.
This is information not provided in my first post.
Version of Glibc : 2.9.
Kernel : Linux 2.6.32.2.Thanks.
-
Just checking, did you rebuild the app against the new debug version of your libraries?
-
I don't remember so I've rebuild it (deleting the old file to be sure) but it's the same.