/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
}
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;
+ }
+}