}
SessionThread::~SessionThread() {
- // shut down thread gracefully
- quit();
- wait();
+ if(_session) {
+ _session->setParent(0);
+ _session->moveToThread(thread());
+ _session->deleteLater();
+ _session = 0;
+ }
}
CoreSession *SessionThread::session() {
emit initialized();
exec();
delete _session;
+ _session = 0;
}
+void SessionThread::stopSession() {
+ if(_session) {
+ connect(_session, SIGNAL(destroyed()), this, SLOT(quit()));
+ _session->deleteLater();
+ _session = 0;
+ }
+}