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

I occasionally make the following mistakes when using Qt4.7 program, please help me check.thanks



  • Program terminated with signal 11, Segmentation fault.
    #0  0xb5a65180 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    (gdb) bt
    #0  0xb5a65180 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #1  0xb5a95c10 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #2  0xb5a93122 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #3  0xb458125f in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #4  0xb4581990 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #5  0xb4581c2a in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #6  0xb5a93ada in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #7  0xb5dafe7a in ?? () from /usr/lib/i386-linux-gnu/libQtGui.so.4
    #8  0xb5a641dd in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #9  0xb5a64421 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #10 0xb5a6919d in QCoreApplication::exec() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
    #11 0xb5cf5924 in QApplication::exec() () from /usr/lib/i386-linux-gnu/libQtGui.so.4
    #12 0x0804dc24 in main (argc=1, argv=0xbfb79704) at main.cpp:203
    (gdb)
    


  • Hi,
    the last line of this error is pointing to your main.cpp line 203, can we see it ?

    @None1 said in I occasionally make the following mistakes when using Qt4.7 program, please help me check.thanks:

    main.cpp:203



  • Hi.
    Thank you for following my question.
    main.cpp:203
    QApplication a(argc, argv);
    //...
    a.exec();



  • @None1 hi,
    well i never used qt4 nor linux so can't really help you, but let's clarify the situation for someone who has knowlage in this.

    What do you mean by "I occasionally make the following mistakes when using Qt4.7 program" ?

    Which user action is triggering this error ?
    Can you run your program in debug mode and reproduct this error ?

    from quick search on the web
    this looks similar
    https://stackoverflow.com/questions/5896495/qcoreapplicationnotifyinternal-segmentation-fault


  • Qt Champions 2017

    Most often that kind of stack trace is produced by having an invalid receiver object. Usually it's caused by having delete in a slot and/or having a queued event for an object, which was deleted in the meantime.



  • I read this blog.According to the blogger, I also blocked UDP related processing, but the problem has not been solved.This exception is not reproducible and may occur irregularly.



  • @LeLev @kshegunov One of the problems is that when a window containing QTimer and QTcpSocket is opened, it occasionally freezes during the closing process.


  • Qt Champions 2017

    @None1 said in I occasionally make the following mistakes when using Qt4.7 program, please help me check.thanks:

    One of the problems is that when a window containing QTimer and QTcpSocket is opened, it occasionally freezes during the closing process.

    Is this the same problem or an unrelated issue?

    @None1 said in I occasionally make the following mistakes when using Qt4.7 program, please help me check.thanks:

    I read this blog.According to the blogger, I also blocked UDP related processing, but the problem has not been solved.

    What blog? Also what UDP processing? we haven't mentioned anything UDP related. Something's also not quite clear are you really using Qt4.7? This Qt version is many many years old, are you sure you don't mean QtCreator 4.7?

    This exception is not reproducible and may occur irregularly.

    Nonetheless you should investigate and try to reproduce it. Or rather try to determine and reproduce the sequence of events that leads to the issue.



  • hi,
    Thank you for following my question.
    First of all, let me answer your question. I am not familiar with Qt FORUM, and I wonder if you can see the answer in the screenshot below.In the reply here, I hope you can also see these contents and help me confirm whether they are relevant, so @ you.
    0_1552353086948_259f70d1-97fd-408c-86b1-7e84591014cb-image.png

    Thank you again, I hope the following supplement can make the question more detailed.
    The failure occurred on the client, which has a Qt environment version of 4.7.4
    The following is the Qt version in my compilation environment

    0_1552351350050_4440206f-4cff-46e3-8bf7-2e5f7a6294e7-image.png

    The first picture I asked was the output interface from GDB debugging the core file. The program would crash irregularly and generate this file about once or twice a day.

    Related phenomena:

    1. Customer response before the program crash, the interface time will not be automatically refreshed.
      My program interface time display is to pass the custom QLabel controls, which use QTimer, per second for a * * QDateTime: : currentDateTime refresh () * *.
    2. Customer's response is that the window cannot be displayed normally when some Windows are opened.
      After my analysis, there are also some QTimer calls in these Windows. Combined with the first point, I judge that the failure of QTimer is the cause.


  • @kshegunov I forgot to add @ here. Looking forward to your reply.


  • Qt Champions 2017

    I don't know what to suggest is all. I haven't worked with Qt this old for a long, long time and moreover you didn't provide any additional information on which I'm to speculate. If you're not using sockets I don't see how the stackoverflow thread is relevant. My best suggestion at this point is to try and reproduce the bug on your development machine and try to discern at least the region of code that's suspect. I've already said what you should be looking for - delete in a slot, or delete whenever you have some kind of event to be sent to the object. As a matter of fact a defensive programming practice in this case is to use QObject::deleteLater whenever possible and never directly delete QObject instances directly.



  • This post is deleted!


  • @kshegunov Ok, thank you very much



  • @None1 if your issue is solved, please don't forget to mark your post as such! Thanks



  • The uncertainty should be due to UDP processing of Qt4.7.4


Log in to reply