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