title: QThread: Destroyed while thread is still running?
body: <p>I would like to start my <code>QThread</code> when I push on button <strong>Run</strong>. But the compiler outputs following error:</p>
  
  <pre><code>QThread: Destroyed while thread is still running
  ASSERT failure in QThread::setTerminationEnabled(): "Current thread was not started with QThread.", file thread\qthread_win.cp.
  </code></pre>
  
  <p>I don't know what is wrong with my code.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>SamplingThread::SamplingThread( QObject *parent):
     QwtSamplingThread( parent ),
     d_frequency( 5.0 )
  {
     init();
  }
  
  MainWindow::MainWindow( QWidget *parent ):
  QMainWindow( parent )
  {.......
    .....
     run= new QPushButton ("Run",this);
     stop= new QPushButton("Stop",this);
     connect(run, SIGNAL(clicked()),this, SLOT (start()));
  }
  
  MainWindow::start
  {
     SamplingThread samplingThread;
     samplingThread.setFrequency( frequency() );
     samplingThread.start();
  }
  
  int main( int argc, char **argv )
  {
     QApplication app( argc, argv );
     MainWindow window;
     window.resize( 700, 400 );
     window.show();
     bool ok = app.exec();
     return ok;
  }
  </code></pre>