Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[SOLVED] QThread

$
0
0
Hi, when quitting my application I get a message “QThread: Destroyed while thread is still running” for each thread that was fired. My code is completely analogous to the example implementation in QThread’s documentation  class Worker : public QObject  {      Q_OBJECT    public slots:      void doWork() {          ...      }  };    void MyObject::putWorkerInAThread()  {      Worker *worker = new Worker;      QThread *workerThread = new QThread(this);        connect(workerThread, SIGNAL(started()), worker, SLOT(doWork()));      connect(workerThread, SIGNAL(finished()), worker, SLOT(deleteLater()));      worker->moveToThread(workerThread);        // Starts an event loop, and emits workerThread->started()      workerThread->start();  } It seems like the signal finished() is never emitted. I also get this message if the function doWork() doesn’t do anything… What can be the reason for this?

Viewing all articles
Browse latest Browse all 18427

Latest Images

Trending Articles



Latest Images