Start a new thread and run the worker_thread()


Qt Code:
  1. QThread *settingsFileUpdaterThread = new QThread;
  2. settings_agent.moveToThread(settingsFileUpdaterThread);
  3. settingsFileUpdaterThread->start();
  4. QMetaObject::invokeMethod(&settings_agent, "worker_thread", Qt::QueuedConnection);
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. void SettingsFileRetrievalAgent::worker_thread()
  2. {
  3. while(1)
  4. status = updateSettingsIfPossible();
  5.  
  6. if (status == RETURN_SUCCESS_CACHE_UPDATED)
  7. {
  8. emit updatedSettingsNotification(); //segfault
  9. }
  10. for( int count = 0; count < 2; ++count )
  11. sleep( 1 );
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 

I have other threads that are just about identical and they don't seem to have a problem when emitting a signal.