Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt C++ code crash (ASSERT: *node == e)
Forum Updated to NodeBB v4.3 + New Features

Qt C++ code crash (ASSERT: *node == e)

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 583 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vyuvaraj
    wrote on last edited by
    #1

    What is reason behind the below error message

    ASSERT: "*node == e || (*node)->next" in file ....\include/QtCore/../../src/corelib/tools/qhash.h, line 918
    11:43:02: The program has unexpectedly finished.
    11:43:02: The process was ended forcefully.

    I have tcp client socket which received 74 bytes of data from server @ 20mSec interval.
    I'm collecting the data using queue and emitting @ every 50mSec interval to other C++ backend class which does processing of the data.
    I'm doubtful if the processing on the backend class is causing the issue?
    How to debug the crash and collect crash log?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Vyuvaraj said in Qt C++ code crash (ASSERT: *node == e):

      How to debug the crash and collect crash log?

      Use a debugger and take a look at the backtrace to see where it comes from. Are you using threads?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

        Code Please

        C++ is a perfectly valid school of magic.

        V 1 Reply Last reply
        1
        • fcarneyF fcarney

          Code Please

          V Offline
          V Offline
          Vyuvaraj
          wrote on last edited by
          #4

          @fcarney

          bool m_quit = false;
          bool m_InProcess = false;
          QTcpSocket *m_sock = nullptr;
          
          tpClient::tpClient(QObject *parent) : QThread(parent) {
             m_InProcess = false;
             m_sock = new QTcpSocket(this);
             connect(m_sock, SIGNAL(connected()), this, SLOT(connected()));
             connect(m_sock, SIGNAL(disconnected()), this, SLOT(disconnected()));
             connect(m_sock, SIGNAL(readyRead()), this, SLOT(readyRead()));
             m_sock->abort();
             m_sock->connectToHost("127.0.0.1",51001);
          }
          
          void tpClient::connected() { if(!isRunning()){start();} }
          
          void tpClient::readyRead() { m_dataInQ.push(m_sock->readAll()); }
          
          void tpClient::run(void) {
            qDebug() <<  "Thread is Running...";
            while(!m_quit){
              while(!m_dataInQ.empty() && !m_InProcess){
              /* This will allow the rendering engine to achieve a consistent 60 frames-per-second refresh rate.
                  60 FPS means that there is approximately 16 milliseconds.
                  Provide 2 times more for safety */
              msleep(32);
          
              if(m_mutex.tryLockForRead(1000)) {
                QByteArray data = m_dataInQ.front();
                m_dataInQ.pop();
                m_mutex.unlock();
                processInput(processRawInput(data));
              }   
            }
          
            msleep(10); 
            }
          }
          
          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Please read the QThread docs - you're doing it wrong, the examples and docs give you a good starting point...

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved