+ auto worker = new Worker(uid, restoreState, strictIdentEnabled);
+ worker->moveToThread(&_sessionThread);
+ connect(&_sessionThread, SIGNAL(started()), worker, SLOT(initialize()));
+ connect(&_sessionThread, SIGNAL(finished()), worker, SLOT(deleteLater()));
+ connect(worker, SIGNAL(initialized()), this, SLOT(onSessionInitialized()));
+ connect(worker, SIGNAL(destroyed()), this, SLOT(onSessionDestroyed()));
+
+ connect(this, SIGNAL(addClientToWorker(Peer*)), worker, SLOT(addClient(Peer*)));
+ connect(this, SIGNAL(shutdownSession()), worker, SLOT(shutdown()));
+
+ // Defer thread start through the event loop, so the SessionThread instance is fully constructed before
+ QTimer::singleShot(0, &_sessionThread, SLOT(start()));