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. GUI: QThread: Destroyed while thread is still running. Helpp
Qt 6.11 is out! See what's new in the release blog

GUI: QThread: Destroyed while thread is still running. Helpp

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.8k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    swatchie-1
    wrote on last edited by
    #1

    Dear all, would appreciate if anyone here can help as I'm still new in this:
    The application crashes when we exit.

    This is the QT bug report:

    Process:               hilux-qt [9042]
    Path:                  /Users/USER/Desktop/*/hilux-qt
    Identifier:            hilux-qt
    Version:               0
    Code Type:             X86-64 (Native)
    Parent Process:        ??? [9018]
    Responsible:           hilux-qt [9042]
    User ID:               501
    
    Date/Time:             2019-06-02 21:50:16.028 +0800
    OS Version:            Mac OS X 10.14.2 (18C54)
    Report Version:        12
    Anonymous UUID:        94D51356-471C-2F36-C6C5-3B14770C78E3
    
    Sleep/Wake UUID:       1EEE5BDE-72C5-4AAC-8476-E51701DEBCF8
    
    Time Awake Since Boot: 19000 seconds
    Time Since Wake:       7400 seconds
    
    System Integrity Protection: enabled
    
    Crashed Thread:        0  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_CRASH (SIGABRT)
    Exception Codes:       0x0000000000000000, 0x0000000000000000
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Application Specific Information:
    abort() called
    
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib        	0x00007fff7772223e __pthread_kill + 10
    1   libsystem_pthread.dylib       	0x00007fff777d8c1c pthread_kill + 285
    2   libsystem_c.dylib             	0x00007fff7768b1c9 abort + 127
    3   org.qt-project.QtCore         	0x0000000109537bc9 0x10951f000 + 101321
    4   org.qt-project.QtCore         	0x0000000109539314 QMessageLogger::fatal(char const*, ...) const + 202
    5   org.qt-project.QtCore         	0x000000010954046d QThread::~QThread() + 189
    6   hilux-qt                      	0x00000001079479ee ToolsPage::~ToolsPage() + 174 (qlist.h:829)
    7   hilux-qt                      	0x0000000107947b4c ToolsPage::~ToolsPage() + 28
    8   org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
    9   org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
    10  hilux-qt                      	0x0000000107988aac WalletView::~WalletView() + 28
    11  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
    12  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
    13  org.qt-project.QtWidgets      	0x0000000108be16ee QStackedWidget::~QStackedWidget() + 14
    14  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
    15  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
    16  hilux-qt                      	0x000000010797200c WalletFrame::~WalletFrame() + 28
    17  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
    18  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
    19  org.qt-project.QtWidgets      	0x0000000108a61d0e QWidget::~QWidget() + 14
    20  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
    21  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
    22  hilux-qt                      	0x0000000107871ee5 HiluxGUI::~HiluxGUI() + 197
    23  hilux-qt                      	0x00000001078720cc HiluxGUI::~HiluxGUI() + 28
    24  hilux-qt                      	0x0000000107853d9d HiluxApplication::~HiluxApplication() + 301 (hilux.cpp:370)
    25  hilux-qt                      	0x0000000107855403 main + 3523
    26  libdyld.dylib                 	0x00007fff775e2ed9 start + 1
    
    

    And this is the cpp script for shutdown:

    private:
        QThread *coreThread;
        OptionsModel *optionsModel;
        ClientModel *clientModel;
        HiluxGUI *window;
        QTimer *pollShutdownTimer;
    #ifdef ENABLE_WALLET
        PaymentServer* paymentServer;
        WalletModel *walletModel;
    #endif
        int returnValue;
        const PlatformStyle *platformStyle;
        std::unique_ptr<QWidget> shutdownWindow;
    
        void startThread();
    };
    
    -----
    
    void HiluxApplication::startThread()
    {
        if(coreThread)
            return;
        coreThread = new QThread(this);
        HiluxCore* executor = new HiluxCore();
        executor->moveToThread(coreThread);
    
        /*  communication to and from thread */
        connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
        connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
        connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
        connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
        connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
        connect(window, SIGNAL(requestedRestart(QStringList)), executor, SLOT(restart(QStringList)));
        /*  make sure executor object is deleted in its own thread */
        connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
        connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
    
        coreThread->start();
    }
    
    ------
    
    void HiluxApplication::requestShutdown()
    {
        // Show a simple window indicating shutdown status
        // Do this first as some of the steps may take some time below,
        // for example the RPC console may still be executing a command.
    
    
        shutdownWindow.reset(ShutdownWindow::showShutdownWindow(window));
    
        qDebug() << __func__ << ": Requesting shutdown";
        startThread();
        window->hide();
        window->setClientModel(0);
        pollShutdownTimer->stop();
    
    #ifdef ENABLE_WALLET
        window->removeAllWallets();
        delete walletModel;
        walletModel = 0;
    #endif
        delete clientModel;
        clientModel = 0;
    
    
    
        StartShutdown();
    
        // Request shutdown from core thread
        Q_EMIT requestedShutdown();
    }
    
    -------
    
    void HiluxCore::shutdown()
    {
        try
        {
            qDebug() << __func__ << ": Running Shutdown in thread";
            Interrupt(threadGroup);
            threadGroup.join_all();
            Shutdown();
    
    
            qDebug() << __func__ << ": Shutdown finished";
            Q_EMIT shutdownResult(1);
        }
          catch (const std::exception& e) {
            handleRunawayException(&e);
        } catch (...) {
            handleRunawayException(NULL);
        }
    
    }
    
    
    

    Appreciate if anyone could help on how to prevent the crash when the application quits.

    kshegunovK 1 Reply Last reply
    0
    • S swatchie-1

      Dear all, would appreciate if anyone here can help as I'm still new in this:
      The application crashes when we exit.

      This is the QT bug report:

      Process:               hilux-qt [9042]
      Path:                  /Users/USER/Desktop/*/hilux-qt
      Identifier:            hilux-qt
      Version:               0
      Code Type:             X86-64 (Native)
      Parent Process:        ??? [9018]
      Responsible:           hilux-qt [9042]
      User ID:               501
      
      Date/Time:             2019-06-02 21:50:16.028 +0800
      OS Version:            Mac OS X 10.14.2 (18C54)
      Report Version:        12
      Anonymous UUID:        94D51356-471C-2F36-C6C5-3B14770C78E3
      
      Sleep/Wake UUID:       1EEE5BDE-72C5-4AAC-8476-E51701DEBCF8
      
      Time Awake Since Boot: 19000 seconds
      Time Since Wake:       7400 seconds
      
      System Integrity Protection: enabled
      
      Crashed Thread:        0  Dispatch queue: com.apple.main-thread
      
      Exception Type:        EXC_CRASH (SIGABRT)
      Exception Codes:       0x0000000000000000, 0x0000000000000000
      Exception Note:        EXC_CORPSE_NOTIFY
      
      Application Specific Information:
      abort() called
      
      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   libsystem_kernel.dylib        	0x00007fff7772223e __pthread_kill + 10
      1   libsystem_pthread.dylib       	0x00007fff777d8c1c pthread_kill + 285
      2   libsystem_c.dylib             	0x00007fff7768b1c9 abort + 127
      3   org.qt-project.QtCore         	0x0000000109537bc9 0x10951f000 + 101321
      4   org.qt-project.QtCore         	0x0000000109539314 QMessageLogger::fatal(char const*, ...) const + 202
      5   org.qt-project.QtCore         	0x000000010954046d QThread::~QThread() + 189
      6   hilux-qt                      	0x00000001079479ee ToolsPage::~ToolsPage() + 174 (qlist.h:829)
      7   hilux-qt                      	0x0000000107947b4c ToolsPage::~ToolsPage() + 28
      8   org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
      9   org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
      10  hilux-qt                      	0x0000000107988aac WalletView::~WalletView() + 28
      11  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
      12  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
      13  org.qt-project.QtWidgets      	0x0000000108be16ee QStackedWidget::~QStackedWidget() + 14
      14  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
      15  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
      16  hilux-qt                      	0x000000010797200c WalletFrame::~WalletFrame() + 28
      17  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
      18  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
      19  org.qt-project.QtWidgets      	0x0000000108a61d0e QWidget::~QWidget() + 14
      20  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
      21  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
      22  hilux-qt                      	0x0000000107871ee5 HiluxGUI::~HiluxGUI() + 197
      23  hilux-qt                      	0x00000001078720cc HiluxGUI::~HiluxGUI() + 28
      24  hilux-qt                      	0x0000000107853d9d HiluxApplication::~HiluxApplication() + 301 (hilux.cpp:370)
      25  hilux-qt                      	0x0000000107855403 main + 3523
      26  libdyld.dylib                 	0x00007fff775e2ed9 start + 1
      
      

      And this is the cpp script for shutdown:

      private:
          QThread *coreThread;
          OptionsModel *optionsModel;
          ClientModel *clientModel;
          HiluxGUI *window;
          QTimer *pollShutdownTimer;
      #ifdef ENABLE_WALLET
          PaymentServer* paymentServer;
          WalletModel *walletModel;
      #endif
          int returnValue;
          const PlatformStyle *platformStyle;
          std::unique_ptr<QWidget> shutdownWindow;
      
          void startThread();
      };
      
      -----
      
      void HiluxApplication::startThread()
      {
          if(coreThread)
              return;
          coreThread = new QThread(this);
          HiluxCore* executor = new HiluxCore();
          executor->moveToThread(coreThread);
      
          /*  communication to and from thread */
          connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
          connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
          connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
          connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
          connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
          connect(window, SIGNAL(requestedRestart(QStringList)), executor, SLOT(restart(QStringList)));
          /*  make sure executor object is deleted in its own thread */
          connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
          connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
      
          coreThread->start();
      }
      
      ------
      
      void HiluxApplication::requestShutdown()
      {
          // Show a simple window indicating shutdown status
          // Do this first as some of the steps may take some time below,
          // for example the RPC console may still be executing a command.
      
      
          shutdownWindow.reset(ShutdownWindow::showShutdownWindow(window));
      
          qDebug() << __func__ << ": Requesting shutdown";
          startThread();
          window->hide();
          window->setClientModel(0);
          pollShutdownTimer->stop();
      
      #ifdef ENABLE_WALLET
          window->removeAllWallets();
          delete walletModel;
          walletModel = 0;
      #endif
          delete clientModel;
          clientModel = 0;
      
      
      
          StartShutdown();
      
          // Request shutdown from core thread
          Q_EMIT requestedShutdown();
      }
      
      -------
      
      void HiluxCore::shutdown()
      {
          try
          {
              qDebug() << __func__ << ": Running Shutdown in thread";
              Interrupt(threadGroup);
              threadGroup.join_all();
              Shutdown();
      
      
              qDebug() << __func__ << ": Shutdown finished";
              Q_EMIT shutdownResult(1);
          }
            catch (const std::exception& e) {
              handleRunawayException(&e);
          } catch (...) {
              handleRunawayException(NULL);
          }
      
      }
      
      
      

      Appreciate if anyone could help on how to prevent the crash when the application quits.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      In your ToolsPage class you have a running thread. Request it shuts down and call QThread::wait before you continue with the destruction is the best I can give you with the limited information I have.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • S Offline
        S Offline
        swatchie-1
        wrote on last edited by
        #3

        Hi kshegunov, i checked the toolspage.cpp and I found this:

            if (!model) {
                // Client model is being set to 0, this means shutdown() is about to be called.
                // Make sure we clean up the executor thread
                Q_EMIT stopExecutor();
                thread.wait();
        
            }
        

        The thread.wait(); is there originally. Is there somewhere else I should look? Here is more about the crash report

        Process:               hilux-qt [9042]
        Path:                  /Users/USER/Desktop/*/hilux-qt
        Identifier:            hilux-qt
        Version:               0
        Code Type:             X86-64 (Native)
        Parent Process:        ??? [9018]
        Responsible:           hilux-qt [9042]
        User ID:               501
        
        Date/Time:             2019-06-02 21:50:16.028 +0800
        OS Version:            Mac OS X 10.14.2 (18C54)
        Report Version:        12
        Anonymous UUID:        94D51356-471C-2F36-C6C5-3B14770C78E3
        
        Sleep/Wake UUID:       1EEE5BDE-72C5-4AAC-8476-E51701DEBCF8
        
        Time Awake Since Boot: 19000 seconds
        Time Since Wake:       7400 seconds
        
        System Integrity Protection: enabled
        
        Crashed Thread:        0  Dispatch queue: com.apple.main-thread
        
        Exception Type:        EXC_CRASH (SIGABRT)
        Exception Codes:       0x0000000000000000, 0x0000000000000000
        Exception Note:        EXC_CORPSE_NOTIFY
        
        Application Specific Information:
        abort() called
        
        Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
        0   libsystem_kernel.dylib        	0x00007fff7772223e __pthread_kill + 10
        1   libsystem_pthread.dylib       	0x00007fff777d8c1c pthread_kill + 285
        2   libsystem_c.dylib             	0x00007fff7768b1c9 abort + 127
        3   org.qt-project.QtCore         	0x0000000109537bc9 0x10951f000 + 101321
        4   org.qt-project.QtCore         	0x0000000109539314 QMessageLogger::fatal(char const*, ...) const + 202
        5   org.qt-project.QtCore         	0x000000010954046d QThread::~QThread() + 189
        6   hilux-qt                      	0x00000001079479ee ToolsPage::~ToolsPage() + 174 (qlist.h:829)
        7   hilux-qt                      	0x0000000107947b4c ToolsPage::~ToolsPage() + 28
        8   org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
        9   org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
        10  hilux-qt                      	0x0000000107988aac WalletView::~WalletView() + 28
        11  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
        12  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
        13  org.qt-project.QtWidgets      	0x0000000108be16ee QStackedWidget::~QStackedWidget() + 14
        14  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
        15  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
        16  hilux-qt                      	0x000000010797200c WalletFrame::~WalletFrame() + 28
        17  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
        18  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
        19  org.qt-project.QtWidgets      	0x0000000108a61d0e QWidget::~QWidget() + 14
        20  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
        21  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
        22  hilux-qt                      	0x0000000107871ee5 HiluxGUI::~HiluxGUI() + 197
        23  hilux-qt                      	0x00000001078720cc HiluxGUI::~HiluxGUI() + 28
        24  hilux-qt                      	0x0000000107853d9d HiluxApplication::~HiluxApplication() + 301 (hilux.cpp:370)
        25  hilux-qt                      	0x0000000107855403 main + 3523
        26  libdyld.dylib                 	0x00007fff775e2ed9 start + 1
        
        Thread 1:: com.apple.CFSocket.private
        0   libsystem_kernel.dylib        	0x00007fff777235aa __select + 10
        1   com.apple.CoreFoundation      	0x00007fff4a3d3cf3 __CFSocketManager + 639
        2   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
        3   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
        4   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
        
        Thread 2:: QDBusConnectionManager
        0   libsystem_kernel.dylib        	0x00007fff777242ee poll + 10
        1   org.qt-project.QtCore         	0x000000010975dab0 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 480
        2   org.qt-project.QtCore         	0x000000010975f2d1 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 897
        3   org.qt-project.QtCore         	0x000000010970316f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
        4   org.qt-project.QtCore         	0x0000000109540a8c QThread::exec() + 140
        5   org.qt-project.QtDBus         	0x0000000109aefa23 0x109aec000 + 14883
        6   org.qt-project.QtCore         	0x0000000109541a03 0x10951f000 + 141827
        7   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
        8   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
        9   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
        
        Thread 3:: com.apple.NSEventThread
        0   libsystem_kernel.dylib        	0x00007fff7771c17a mach_msg_trap + 10
        1   libsystem_kernel.dylib        	0x00007fff7771c6d0 mach_msg + 60
        2   com.apple.CoreFoundation      	0x00007fff4a3a60c2 __CFRunLoopServiceMachPort + 337
        3   com.apple.CoreFoundation      	0x00007fff4a3a5611 __CFRunLoopRun + 1654
        4   com.apple.CoreFoundation      	0x00007fff4a3a4d48 CFRunLoopRunSpecific + 463
        5   com.apple.AppKit              	0x00007fff478fef89 _NSEventThread + 160
        6   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
        7   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
        8   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
        
        Thread 4:
        0   libsystem_kernel.dylib        	0x00007fff7771f7de __psynch_cvwait + 10
        1   libsystem_pthread.dylib       	0x00007fff777d9593 _pthread_cond_wait + 724
        2   hilux-qt                      	0x0000000107e0fe2b leveldb::(anonymous namespace)::PosixEnv::BGThread() + 219 (env_posix.cc:499)
        3   hilux-qt                      	0x0000000107e0fd49 leveldb::(anonymous namespace)::PosixEnv::BGThreadWrapper(void*) + 9
        4   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
        5   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
        6   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
        
        Thread 5:: QThread
        0   libsystem_kernel.dylib        	0x00007fff777242ee poll + 10
        1   org.qt-project.QtCore         	0x000000010975dab0 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 480
        2   org.qt-project.QtCore         	0x000000010975f2d1 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 897
        3   org.qt-project.QtCore         	0x000000010970316f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
        4   org.qt-project.QtCore         	0x0000000109540a8c QThread::exec() + 140
        5   org.qt-project.QtCore         	0x0000000109541a03 0x10951f000 + 141827
        6   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
        7   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
        8   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
        
        Thread 6:: Qt bearer thread
        0   libsystem_kernel.dylib        	0x00007fff777242ee poll + 10
        1   org.qt-project.QtCore         	0x000000010975d940 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 112
        2   org.qt-project.QtCore         	0x000000010975f2d1 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 897
        3   org.qt-project.QtCore         	0x000000010970316f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
        4   org.qt-project.QtCore         	0x0000000109540a8c QThread::exec() + 140
        5   org.qt-project.QtCore         	0x0000000109541a03 0x10951f000 + 141827
        6   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
        7   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
        8   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
        
        Thread 7:
        0   libsystem_pthread.dylib       	0x00007fff777d53f8 start_wqthread + 0
        1   ???                           	0x0000000054485244 0 + 1414025796
        
        Thread 8:
        0   libsystem_pthread.dylib       	0x00007fff777d53f8 start_wqthread + 0
        1   ???                           	0x0000000000000903 0 + 2307
        
        Thread 9:
        0   libsystem_pthread.dylib       	0x00007fff777d53f8 start_wqthread + 0
        
        Thread 0 crashed with X86 Thread State (64-bit):
          rax: 0x0000000000000000  rbx: 0x000000010b1cb5c0  rcx: 0x00007ffee83b6178  rdx: 0x0000000000000000
          rdi: 0x0000000000000307  rsi: 0x0000000000000006  rbp: 0x00007ffee83b61b0  rsp: 0x00007ffee83b6178
           r8: 0x0000000000000003   r9: 0x00007fe2c8e6c720  r10: 0x0000000000000000  r11: 0x0000000000000206
          r12: 0x0000000000000307  r13: 0x0000000000000001  r14: 0x0000000000000006  r15: 0x000000000000002d
          rip: 0x00007fff7772223e  rfl: 0x0000000000000206  cr2: 0x00007fffaa3cc188
          
        Logical CPU:     0
        Error Code:      0x02000148
        Trap Number:     133
        
        
        kshegunovK 1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
          wrote on last edited by
          #4

          where you are creating the object of HiluxApplication ? Since you are passing HiluxApplication object as parent of QThread, HiluxApplication is getting destroyed somewhere when still your thread is executing. May be you need to check this.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          https://www.pthinks.com

          1 Reply Last reply
          0
          • S swatchie-1

            Hi kshegunov, i checked the toolspage.cpp and I found this:

                if (!model) {
                    // Client model is being set to 0, this means shutdown() is about to be called.
                    // Make sure we clean up the executor thread
                    Q_EMIT stopExecutor();
                    thread.wait();
            
                }
            

            The thread.wait(); is there originally. Is there somewhere else I should look? Here is more about the crash report

            Process:               hilux-qt [9042]
            Path:                  /Users/USER/Desktop/*/hilux-qt
            Identifier:            hilux-qt
            Version:               0
            Code Type:             X86-64 (Native)
            Parent Process:        ??? [9018]
            Responsible:           hilux-qt [9042]
            User ID:               501
            
            Date/Time:             2019-06-02 21:50:16.028 +0800
            OS Version:            Mac OS X 10.14.2 (18C54)
            Report Version:        12
            Anonymous UUID:        94D51356-471C-2F36-C6C5-3B14770C78E3
            
            Sleep/Wake UUID:       1EEE5BDE-72C5-4AAC-8476-E51701DEBCF8
            
            Time Awake Since Boot: 19000 seconds
            Time Since Wake:       7400 seconds
            
            System Integrity Protection: enabled
            
            Crashed Thread:        0  Dispatch queue: com.apple.main-thread
            
            Exception Type:        EXC_CRASH (SIGABRT)
            Exception Codes:       0x0000000000000000, 0x0000000000000000
            Exception Note:        EXC_CORPSE_NOTIFY
            
            Application Specific Information:
            abort() called
            
            Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
            0   libsystem_kernel.dylib        	0x00007fff7772223e __pthread_kill + 10
            1   libsystem_pthread.dylib       	0x00007fff777d8c1c pthread_kill + 285
            2   libsystem_c.dylib             	0x00007fff7768b1c9 abort + 127
            3   org.qt-project.QtCore         	0x0000000109537bc9 0x10951f000 + 101321
            4   org.qt-project.QtCore         	0x0000000109539314 QMessageLogger::fatal(char const*, ...) const + 202
            5   org.qt-project.QtCore         	0x000000010954046d QThread::~QThread() + 189
            6   hilux-qt                      	0x00000001079479ee ToolsPage::~ToolsPage() + 174 (qlist.h:829)
            7   hilux-qt                      	0x0000000107947b4c ToolsPage::~ToolsPage() + 28
            8   org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
            9   org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
            10  hilux-qt                      	0x0000000107988aac WalletView::~WalletView() + 28
            11  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
            12  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
            13  org.qt-project.QtWidgets      	0x0000000108be16ee QStackedWidget::~QStackedWidget() + 14
            14  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
            15  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
            16  hilux-qt                      	0x000000010797200c WalletFrame::~WalletFrame() + 28
            17  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
            18  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
            19  org.qt-project.QtWidgets      	0x0000000108a61d0e QWidget::~QWidget() + 14
            20  org.qt-project.QtCore         	0x0000000109730b04 QObjectPrivate::deleteChildren() + 228
            21  org.qt-project.QtWidgets      	0x0000000108a61442 QWidget::~QWidget() + 1090
            22  hilux-qt                      	0x0000000107871ee5 HiluxGUI::~HiluxGUI() + 197
            23  hilux-qt                      	0x00000001078720cc HiluxGUI::~HiluxGUI() + 28
            24  hilux-qt                      	0x0000000107853d9d HiluxApplication::~HiluxApplication() + 301 (hilux.cpp:370)
            25  hilux-qt                      	0x0000000107855403 main + 3523
            26  libdyld.dylib                 	0x00007fff775e2ed9 start + 1
            
            Thread 1:: com.apple.CFSocket.private
            0   libsystem_kernel.dylib        	0x00007fff777235aa __select + 10
            1   com.apple.CoreFoundation      	0x00007fff4a3d3cf3 __CFSocketManager + 639
            2   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
            3   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
            4   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
            
            Thread 2:: QDBusConnectionManager
            0   libsystem_kernel.dylib        	0x00007fff777242ee poll + 10
            1   org.qt-project.QtCore         	0x000000010975dab0 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 480
            2   org.qt-project.QtCore         	0x000000010975f2d1 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 897
            3   org.qt-project.QtCore         	0x000000010970316f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
            4   org.qt-project.QtCore         	0x0000000109540a8c QThread::exec() + 140
            5   org.qt-project.QtDBus         	0x0000000109aefa23 0x109aec000 + 14883
            6   org.qt-project.QtCore         	0x0000000109541a03 0x10951f000 + 141827
            7   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
            8   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
            9   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
            
            Thread 3:: com.apple.NSEventThread
            0   libsystem_kernel.dylib        	0x00007fff7771c17a mach_msg_trap + 10
            1   libsystem_kernel.dylib        	0x00007fff7771c6d0 mach_msg + 60
            2   com.apple.CoreFoundation      	0x00007fff4a3a60c2 __CFRunLoopServiceMachPort + 337
            3   com.apple.CoreFoundation      	0x00007fff4a3a5611 __CFRunLoopRun + 1654
            4   com.apple.CoreFoundation      	0x00007fff4a3a4d48 CFRunLoopRunSpecific + 463
            5   com.apple.AppKit              	0x00007fff478fef89 _NSEventThread + 160
            6   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
            7   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
            8   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
            
            Thread 4:
            0   libsystem_kernel.dylib        	0x00007fff7771f7de __psynch_cvwait + 10
            1   libsystem_pthread.dylib       	0x00007fff777d9593 _pthread_cond_wait + 724
            2   hilux-qt                      	0x0000000107e0fe2b leveldb::(anonymous namespace)::PosixEnv::BGThread() + 219 (env_posix.cc:499)
            3   hilux-qt                      	0x0000000107e0fd49 leveldb::(anonymous namespace)::PosixEnv::BGThreadWrapper(void*) + 9
            4   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
            5   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
            6   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
            
            Thread 5:: QThread
            0   libsystem_kernel.dylib        	0x00007fff777242ee poll + 10
            1   org.qt-project.QtCore         	0x000000010975dab0 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 480
            2   org.qt-project.QtCore         	0x000000010975f2d1 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 897
            3   org.qt-project.QtCore         	0x000000010970316f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
            4   org.qt-project.QtCore         	0x0000000109540a8c QThread::exec() + 140
            5   org.qt-project.QtCore         	0x0000000109541a03 0x10951f000 + 141827
            6   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
            7   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
            8   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
            
            Thread 6:: Qt bearer thread
            0   libsystem_kernel.dylib        	0x00007fff777242ee poll + 10
            1   org.qt-project.QtCore         	0x000000010975d940 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 112
            2   org.qt-project.QtCore         	0x000000010975f2d1 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 897
            3   org.qt-project.QtCore         	0x000000010970316f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
            4   org.qt-project.QtCore         	0x0000000109540a8c QThread::exec() + 140
            5   org.qt-project.QtCore         	0x0000000109541a03 0x10951f000 + 141827
            6   libsystem_pthread.dylib       	0x00007fff777d6305 _pthread_body + 126
            7   libsystem_pthread.dylib       	0x00007fff777d926f _pthread_start + 70
            8   libsystem_pthread.dylib       	0x00007fff777d5415 thread_start + 13
            
            Thread 7:
            0   libsystem_pthread.dylib       	0x00007fff777d53f8 start_wqthread + 0
            1   ???                           	0x0000000054485244 0 + 1414025796
            
            Thread 8:
            0   libsystem_pthread.dylib       	0x00007fff777d53f8 start_wqthread + 0
            1   ???                           	0x0000000000000903 0 + 2307
            
            Thread 9:
            0   libsystem_pthread.dylib       	0x00007fff777d53f8 start_wqthread + 0
            
            Thread 0 crashed with X86 Thread State (64-bit):
              rax: 0x0000000000000000  rbx: 0x000000010b1cb5c0  rcx: 0x00007ffee83b6178  rdx: 0x0000000000000000
              rdi: 0x0000000000000307  rsi: 0x0000000000000006  rbp: 0x00007ffee83b61b0  rsp: 0x00007ffee83b6178
               r8: 0x0000000000000003   r9: 0x00007fe2c8e6c720  r10: 0x0000000000000000  r11: 0x0000000000000206
              r12: 0x0000000000000307  r13: 0x0000000000000001  r14: 0x0000000000000006  r15: 0x000000000000002d
              rip: 0x00007fff7772223e  rfl: 0x0000000000000206  cr2: 0x00007fffaa3cc188
              
            Logical CPU:     0
            Error Code:      0x02000148
            Trap Number:     133
            
            
            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @swatchie-1 said in GUI: QThread: Destroyed while thread is still running. Helpp:

            Hi kshegunov, i checked the toolspage.cpp and I found this

            This is where? You must realize I can only guess based on the stack trace and I really hate that modus operandi. I'd expect to see something like this in the ToolsPage destructor:

            thread.quit();
            thread.wait();
            

            As a general advice - try to reduce the problem to a minimal example, usually this manifests where the problem is.

            Read and abide by the Qt Code of Conduct

            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