Qt World Summit: Register Today!

QT Gui application segmentation fault on exit

  • Hi,
    I have previously developed and successfully used a Qt application using Ti's Sitara SDK (ti-sdk-am335x-evm- which built applications based on Qt4.8.4
    On migrating to ti-processor-sdk-linux-am335x-evm-, now using Qt5.4.1, the same application now has a segmentation fault on exit.
    To debug the issue i created the simple HelloWorld application below, where the same segFault occurs on exit

    #include <QApplication>
    #include <QLabel>
    #include <QTimer>
    #include <QDebug>

    int main(int argc, char *argv[])
    QApplication app(argc, argv);

    qDebug() << "hello world!" << endl;

    QLabel label("this is a text label!");

    QTimer::singleShot( 2000, &app, SLOT( quit() ) );

    qDebug() << "app.exec() return code :" << app.exec();

    return 0;

    If i remove the line 'label.show();' then the application runs successfully and no segmentation Fault occurs.
    The issue appears only to occur when a GUI is displayed for the application.
    I have tried to track down the issue using strace and running the application in debug mode but have been unable to narrow it down. The application crashes on the line 'return 0;'
    Any help on narrowing down the issue would be appreciated, thanks

  • Lifetime Qt Champion


    You should try to get a stack trace of your crash, that will help narrow down the problem.

Log in to reply