}
SessionThread::~SessionThread() {
- if(_session) {
- _session->setParent(0);
- _session->moveToThread(thread());
- _session->deleteLater();
- _session = 0;
- }
+ // shut down thread gracefully
+ quit();
+ wait();
}
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;
- }
-}