title: Race condition with QThread/QDialog
body: <p>I'm trying to avoid a race condition in the following scenario:</p>
  
  <pre><code>QDialog* dialog = [...];
  QThread* thread = [...];
  
  connect(thread, SIGNAL(finished()), dialog, SLOT(accept()));
  
  thread-&gt;start();
  dialog-&gt;exec();
  </code></pre>
  
  <p>When the thread finishes before QDialog::exec() has set up the dialog, the "accept()" call that was triggered by the signal will be lost and the dialog will not close itself...</p>
  
  <p>So ideally I want to start the thread only after the dialog is ready to handle it, but how would I do this?</p>