Application crash for deleteLater()



  • in my program i delete an object using:

    @myObj->deleteLater();
    QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); @

    but sometimes i get this error:

    @>&"bt\n"

    ~"#0 0xb7029edc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#1 0xb7079282 in QTimerInfoList::activateTimers() () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#2 0xb7079b38 in ?? () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#3 0xb6572d46 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0\n"
    ~"#4 0xb65730e5 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0\n"
    ~"#5 0xb65731c1 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0\n"
    ~"#6 0xb707a328 in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#7 0xb3f44566 in ?? () from /home/bnm/Qt5.1.1/5.1.1/gcc/plugins/platforms/libqxcb.so\n"
    ~"#8 0xb70285e6 in QEventLoop::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#9 0xb7028a2c in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#10 0xb702d122 in QCoreApplication::exec() () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
    ~"#11 0xb7308d84 in QGuiApplication::exec() () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Gui.so.5\n"
    ~"#12 0xb794bbb4 in QApplication::exec() () from /home/bnm/Qt5.1.1/5.1.1/gcc/lib/libQt5Widgets.so.5\n"
    ~"#13 0x08053561 in main (argc=1, argv=0xbffff7c4) at ../project/main.cpp:11\n"
    1434^done@

    What could be the problem?



  • I can only guess that myObj is a QTimer's slot receiver, which is destroyed while timer is still running ...



  • inside myobj there are some qtimer declared with:
    myTimer = new QTimer(this)


Log in to reply
 

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