Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Segmentation fault during QApplication.exec()



  • Hey,

    I've got a segmentation during the QApplication.exec() call, the seg fault doesn't occurs every time i launch the program bur more ling 6 times on 10. Do you know what could cause it ?

    Here is a backtrace from GDB:
    Thread 1 "client" received signal SIGSEGV, Segmentation fault.
    0x00007ffff61fcd56 in QMetaObject::activate(QObject*, int, int, void**) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    (gdb) bt full
    #0 0x00007ffff61fcd56 in QMetaObject::activate(QObject*, int, int, void**) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    No symbol table info available.
    #1 0x00007ffff7669b07 in QWidgetLineControl::processKeyEvent(QKeyEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #2 0x00007ffff75d9daa in QLineEdit::keyPressEvent(QKeyEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #3 0x00007ffff74e9db4 in QWidget::event(QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #4 0x00007ffff75df6f5 in QLineEdit::event(QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #5 0x00007ffff74a452c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #6 0x00007ffff74ab029 in QApplication::notify(QObject*, QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #7 0x00007ffff61d5ae0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    No symbol table info available.
    #8 0x00007ffff750752b in ?? () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #9 0x00007ffff74a452c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #10 0x00007ffff74ab220 in QApplication::notify(QObject*, QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    No symbol table info available.
    #11 0x00007ffff61d5ae0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    No symbol table info available.
    #12 0x00007ffff6775a58 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Gui.so.5
    No symbol table info available.
    #13 0x00007ffff677a725 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Gui.so.5
    No symbol table info available.
    #14 0x00007ffff675be73 in QWindowSystemInterface::sendWindowSystemEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Gui.so.5
    No symbol table info available.
    #15 0x00007fffec943080 in ?? () from /home/benjamin/Qt5.7.0/5.7/gcc_64/plugins/platforms/../../lib/libQt5XcbQpa.so.5
    No symbol table info available.
    #16 0x00007ffff1db4197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    No symbol table info available.
    #17 0x00007ffff1db43f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    No symbol table info available.
    #18 0x00007ffff1db449c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    No symbol table info available.
    #19 0x00007ffff6223047 in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    No symbol table info available.
    #20 0x00007ffff61d3dca in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    No symbol table info available.
    #21 0x00007ffff61dbbad in QCoreApplication::exec() () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5
    No symbol table info available.
    #22 0x0000000000408e92 in main (argc=2, argv=0x7fffffffe3b8) at /home/benjamin/CLionProjects/Group4/code/client/ClientLauncher.cpp:37
    application = <incomplete type>
    app = {_vptr.App = 0x64f628 <vtable for App+16>, server_ip_address = 0x7fffffffe765 "127.0.0.1", player_id = 11, username = "b", current_manager = 0xa1f290}
    app = {_vptr.App = 0x64f628 <vtable for App+16>, server_ip_address = 0x7fffffffe765 "127.0.0.1", player_id = 11, username = "b", current_manager = 0xa1f290}



  • Hi, welcome to the forum.

    signal SIGSEGV, Segmentation fault.

    ClientLauncher.cpp:37

    Somewhere in line 37 bad things happen. Maybe you want to show us some code? :)



  • I can't post all the source code but line 37 is simply : return application.exec();



  • application is a QApplication ;)



  • Without code, no-one but you can find out.


  • Moderators

    @Jibims said in Segmentation fault during QApplication.exec():

    #1 0x00007ffff7669b07 in QWidgetLineControl::processKeyEvent(QKeyEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5
    #2 0x00007ffff75d9daa in QLineEdit::keyPressEvent(QKeyEvent*) () from /home/benjamin/Qt5.7.0/5.7/gcc_64/lib/libQt5Widgets.so.5

    I don't know what's causing the crash, but these lines look interesting. Are you pressing any keys during application startup? Does it still crash if you refrain from pressing any keys?



  • Yep, there is no seg fault if i don't press any key


  • Moderators

    @Jibims said in Segmentation fault during QApplication.exec():

    Yep, there is no seg fault if i don't press any key

    So back in Qt 5.4, does it crash if you press keys at startup?



  • @JKSH Dunno, i have to use Qt 5.7 :/


  • Moderators

    @Jibims said in Segmentation fault during QApplication.exec():

    @JKSH Dunno, i have to use Qt 5.7 :/

    Sorry, I got mixed up between your issue and someone else (they got crashes after upgrading from Qt 5.4).

    Anyway,

    1. Is it a particular key that causes the crash? Or does it crash no matter what key you're pressing at startup?
    2. At startup, if you wait for 5 seconds before you press the key(s), does it still crash?

  • Lifetime Qt Champion

    Hi,

    Even if you have to use 5.7, it's a good idea to test against an older version to help determine whether that behaviour is new to 5.7.


Log in to reply