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. corrupted double-linked list error after closing main window

corrupted double-linked list error after closing main window

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 2 Posters 3.1k 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.
  • D Dijkstra

    so i get a very long error starting with

    corrupted double-linked list: 0x0000000002081a70 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7fdae30987f5]
    /lib/x86_64-linux-gnu/libc.so.6(+0x7e6fd)[0x7fdae309f6fd]
    /lib/x86_64-linux-gnu/libc.so.6(+0x80688)[0x7fdae30a1688]
    

    after closing the main window what i am trying to do is choose a json file and parse it extract data from it
    the data is extracted correctly but closing the mainwindow causes the app to crash
    this is how i kill the qprocesses

    void plugin::terminate_kill(){
        QProcess::execute("kill", QStringList()<< "-9" << QString::number(getpid()));
    }
    

    this is how i run them and track if they finished then stop them

    void Sessions::Run(QString type){
    
        for(auto it:Plugins){
            //std::cout<<(*it)<<std::endl;
            if(it->gettype()==type)
                it->run();
        }
        emit(start_cpu_gpu(false));
    }
    void Sessions::recievefinishedid(int id){
        std::cout<<"plugin number "<<id<<" has finished"<<std::endl;
        add_finished();
        Plugins[id]->terminate_kill();
        if(get_finished()==get_existing()){
            stop_servers();
        }
    }
    void Sessions::stop_servers(){
        for(auto it:Plugins){
            if(it->gettype()=="server"){
                it->terminate_kill();
                std::cout<<it->getname().toStdString()<<' '<<"stopped"<<std::endl;
            }
        }
        emit(plugins_finished(false));
    }
    

    and this is how i start it

    void plugin::run(){
        //plugin_process.start("/bin/bash",QStringList()<<getfilename()<<" -v3 -j "<<getjsonfilename());
        plugin_process.start("/bin/bash",QStringList() << "-c" <<getfilename());
        if(plugin_process.pid()){
            QString nstart=getname()+" started";
            std::cout<<getname().toStdString()<<" started"<<std::endl;
            setpid(plugin_process.pid());
            QObject::connect(&plugin_process , SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
            QObject::connect(&plugin_process , SIGNAL(started()), this, SLOT(processStarted()));
            QObject::connect(&plugin_process , SIGNAL(readyReadStandardOutput()), this, SLOT(processStandardOutput()));
        }
        else{
            std::cout<<"failed to start "<<getname().toStdString()<<std::endl;
        }
    }
    
    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #2

    @Dijkstra
    Some things show up when main window closed/program exited, e.g. double-deletion of objects.

    I do not see you using a "double-linked list". As ever with a crash, same every time, run in debugger. When it crashes debugger should break, look at stack trace window, trace back to your own code to see where it came from.

    BTW, in terminate_kill() you kill the pid from getpid(). Which getpid() is this? If it's Linux's ::getpid() you are killing yourself....

    D 2 Replies Last reply
    0
    • JonBJ JonB

      @Dijkstra
      Some things show up when main window closed/program exited, e.g. double-deletion of objects.

      I do not see you using a "double-linked list". As ever with a crash, same every time, run in debugger. When it crashes debugger should break, look at stack trace window, trace back to your own code to see where it came from.

      BTW, in terminate_kill() you kill the pid from getpid(). Which getpid() is this? If it's Linux's ::getpid() you are killing yourself....

      D Offline
      D Offline
      Dijkstra
      wrote on last edited by
      #3

      @JonB ran in debugger and this was the output after the error

      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      RTTI symbol not found for class 'QWidget'
      
      JonBJ 1 Reply Last reply
      0
      • D Dijkstra

        @JonB ran in debugger and this was the output after the error

        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        RTTI symbol not found for class 'QWidget'
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #4

        @Dijkstra
        No, that is irrelevant. Please take the time to read what I wrote. What did I write in bold?

        1 Reply Last reply
        0
        • JonBJ JonB

          @Dijkstra
          Some things show up when main window closed/program exited, e.g. double-deletion of objects.

          I do not see you using a "double-linked list". As ever with a crash, same every time, run in debugger. When it crashes debugger should break, look at stack trace window, trace back to your own code to see where it came from.

          BTW, in terminate_kill() you kill the pid from getpid(). Which getpid() is this? If it's Linux's ::getpid() you are killing yourself....

          D Offline
          D Offline
          Dijkstra
          wrote on last edited by
          #5

          @JonB no its a getter to get the qprocess pid
          do u mean this ?
          Screenshot from 2020-12-28 12-13-29.png
          i ran in debugger and that is what i got

          JonBJ 1 Reply Last reply
          0
          • D Dijkstra

            @JonB no its a getter to get the qprocess pid
            do u mean this ?
            Screenshot from 2020-12-28 12-13-29.png
            i ran in debugger and that is what i got

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #6

            @Dijkstra said in corrupted double-linked list error after closing main window:

            no its a getter to get the qprocess pid

            That's OK then.

            do u mean this ?

            Not the top window, because that window is entitled Disassembler. But yes for the window underneath that. But you have stopped at the bottom-most 11 calls --- which btw does indeed show your problem is inside some free(), exactly as I suspected (trying to free something bad/already freed, during some "font destroy"). You need to keep scrolling down that pane, till we can see where in your code it came from. (I'm not sure, but you may be able to "copy as text" (right-click?) and paste here, instead of screenshots.)

            D 1 Reply Last reply
            0
            • JonBJ JonB

              @Dijkstra said in corrupted double-linked list error after closing main window:

              no its a getter to get the qprocess pid

              That's OK then.

              do u mean this ?

              Not the top window, because that window is entitled Disassembler. But yes for the window underneath that. But you have stopped at the bottom-most 11 calls --- which btw does indeed show your problem is inside some free(), exactly as I suspected (trying to free something bad/already freed, during some "font destroy"). You need to keep scrolling down that pane, till we can see where in your code it came from. (I'm not sure, but you may be able to "copy as text" (right-click?) and paste here, instead of screenshots.)

              D Offline
              D Offline
              Dijkstra
              wrote on last edited by
              #7

              @JonB this is the correct scrrenshot
              Screenshot from 2020-12-28 12-25-55.png

              JonBJ 1 Reply Last reply
              0
              • D Dijkstra

                @JonB this is the correct scrrenshot
                Screenshot from 2020-12-28 12-25-55.png

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #8

                @Dijkstra
                So it's failing while destructing some QString, which in turn is happening while destructing MainWindow. Please, like I have said several times, move the "current frame" into your code. There's no point being shown it has died in qdataarray.h, we need to see what line in your code is the cause, and then figure out what you have done wrong about it. Maybe you can even break in the main window destructor so we can see which QString (content) it is trying to destruct. I'll look at it again if/when you show the needed information.....

                D 1 Reply Last reply
                1
                • JonBJ JonB

                  @Dijkstra
                  So it's failing while destructing some QString, which in turn is happening while destructing MainWindow. Please, like I have said several times, move the "current frame" into your code. There's no point being shown it has died in qdataarray.h, we need to see what line in your code is the cause, and then figure out what you have done wrong about it. Maybe you can even break in the main window destructor so we can see which QString (content) it is trying to destruct. I'll look at it again if/when you show the needed information.....

                  D Offline
                  D Offline
                  Dijkstra
                  wrote on last edited by
                  #9

                  @JonB i dont know where the current frame is and now the table changes for no reason and shows this Screenshot from 2020-12-28 12-46-57.png

                  JonBJ 1 Reply Last reply
                  0
                  • D Dijkstra

                    @JonB i dont know where the current frame is and now the table changes for no reason and shows this Screenshot from 2020-12-28 12-46-57.png

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #10

                    @Dijkstra said in corrupted double-linked list error after closing main window:

                    and now the table changes for no reason

                    No comment.

                    Do you do anything with fonts in your app? All the errors seem to have something to do with that. Can't say more from the information you show.

                    D 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @Dijkstra said in corrupted double-linked list error after closing main window:

                      and now the table changes for no reason

                      No comment.

                      Do you do anything with fonts in your app? All the errors seem to have something to do with that. Can't say more from the information you show.

                      D Offline
                      D Offline
                      Dijkstra
                      wrote on last edited by
                      #11

                      @JonB after trying to debugg i found that the problem occurs when i parse the json file and this is the function

                      void Sessions::parsejsonfile(QString inputFileName){
                      
                          QJsonParseError jsonError;
                          QFile file;
                          file.setFileName(inputFileName);
                          bool open=file.open(QIODevice::ReadOnly | QIODevice::Text);
                          if(open){
                              QString file_values=file.readAll();
                              file.close();
                              QJsonDocument parsejson = QJsonDocument::fromJson(file_values.toUtf8(),&jsonError);
                              if (QJsonParseError::NoError != jsonError.error) {
                                  std::cout<<"error parsing json file"<<std::endl;
                              }
                              else{
                                  QJsonObject jsonobject = parsejson.object();
                                  QJsonValue plugin_file_name=jsonobject.value(QString("file"));
                                  QJsonValue jsonfile=jsonobject.value(QString("JSON_File"));
                                  QJsonValue name=jsonobject.value(QString("name"));
                                  QJsonValue number_instances=jsonobject.value(QString("number_instants"));
                                  plugin *Plugin=new plugin();
                                  Plugin->setfilename(plugin_file_name.toString());
                                  Plugin->setjsonfilename(jsonfile.toString());
                                  Plugin->setname(name.toString());
                                  Plugin->setnumber_instances(number_instances.toString().toInt());
                                  Plugin->settype(QString("plugin"));
                                  Plugin->setid(0);
                                  QObject::connect(Plugin, SIGNAL(sendfinishedid(int)),
                                                   this, SLOT(recievefinishedid(int)));
                                  QObject::connect(Plugin, SIGNAL(LogMessage(QString)),
                                                   this, SLOT(logMessage(QString)));
                                  Plugins.push_back(Plugin);
                                  add_existing();
                                  QJsonValue gpu_servers_configurations=jsonobject.value(QString("gpu_servers_configurations"));
                                  QJsonArray array=gpu_servers_configurations.toArray();
                                  int idx=1;
                                  foreach(const QJsonValue &it,array){
                                      plugin *server=new plugin();
                                      server->setname(it.toObject().value(QString("name")).toString());
                                      server->setjsonfilename(it.toObject().value(QString("JSON_File")).toString());
                                      server->setfilename(it.toObject().value(QString("path")).toString());
                                      server->setnumber_instances(it.toObject().value(QString("number_instants")).toString().toInt());
                                      server->settype(QString("server"));
                                      server->setid(idx);
                                      Plugins.push_back(server);
                                      idx++;
                                  }
                              }
                          }
                          else{
                              std::cout<<"failed to open file"<<std::endl;
                          }
                      }
                      

                      when i fire this function only after choosing the file and closing the error occurs when i remove it no probhlems happen

                      JonBJ 1 Reply Last reply
                      0
                      • D Dijkstra

                        @JonB after trying to debugg i found that the problem occurs when i parse the json file and this is the function

                        void Sessions::parsejsonfile(QString inputFileName){
                        
                            QJsonParseError jsonError;
                            QFile file;
                            file.setFileName(inputFileName);
                            bool open=file.open(QIODevice::ReadOnly | QIODevice::Text);
                            if(open){
                                QString file_values=file.readAll();
                                file.close();
                                QJsonDocument parsejson = QJsonDocument::fromJson(file_values.toUtf8(),&jsonError);
                                if (QJsonParseError::NoError != jsonError.error) {
                                    std::cout<<"error parsing json file"<<std::endl;
                                }
                                else{
                                    QJsonObject jsonobject = parsejson.object();
                                    QJsonValue plugin_file_name=jsonobject.value(QString("file"));
                                    QJsonValue jsonfile=jsonobject.value(QString("JSON_File"));
                                    QJsonValue name=jsonobject.value(QString("name"));
                                    QJsonValue number_instances=jsonobject.value(QString("number_instants"));
                                    plugin *Plugin=new plugin();
                                    Plugin->setfilename(plugin_file_name.toString());
                                    Plugin->setjsonfilename(jsonfile.toString());
                                    Plugin->setname(name.toString());
                                    Plugin->setnumber_instances(number_instances.toString().toInt());
                                    Plugin->settype(QString("plugin"));
                                    Plugin->setid(0);
                                    QObject::connect(Plugin, SIGNAL(sendfinishedid(int)),
                                                     this, SLOT(recievefinishedid(int)));
                                    QObject::connect(Plugin, SIGNAL(LogMessage(QString)),
                                                     this, SLOT(logMessage(QString)));
                                    Plugins.push_back(Plugin);
                                    add_existing();
                                    QJsonValue gpu_servers_configurations=jsonobject.value(QString("gpu_servers_configurations"));
                                    QJsonArray array=gpu_servers_configurations.toArray();
                                    int idx=1;
                                    foreach(const QJsonValue &it,array){
                                        plugin *server=new plugin();
                                        server->setname(it.toObject().value(QString("name")).toString());
                                        server->setjsonfilename(it.toObject().value(QString("JSON_File")).toString());
                                        server->setfilename(it.toObject().value(QString("path")).toString());
                                        server->setnumber_instances(it.toObject().value(QString("number_instants")).toString().toInt());
                                        server->settype(QString("server"));
                                        server->setid(idx);
                                        Plugins.push_back(server);
                                        idx++;
                                    }
                                }
                            }
                            else{
                                std::cout<<"failed to open file"<<std::endl;
                            }
                        }
                        

                        when i fire this function only after choosing the file and closing the error occurs when i remove it no probhlems happen

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #12

                        @Dijkstra
                        Don't know why that is relevant, or why this has a connection to fonts, if indeed it does. Comment out bits here --- especially whatever else it calls/causes to happen --- and see how you go.

                        1 Reply Last reply
                        0

                        • Login

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