X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fsessionthread.cpp;h=c29d1ff78b588e0c7154253f80b9382ca3090ec5;hp=6a17bd9f402836cb872774d50a2975a066e4bf67;hb=453ccab6ade4a21c7aa3c331af893c91468250a4;hpb=01922b87be01cd5c9844d2a273acd9a71aee8e96 diff --git a/src/core/sessionthread.cpp b/src/core/sessionthread.cpp index 6a17bd9f..c29d1ff7 100644 --- a/src/core/sessionthread.cpp +++ b/src/core/sessionthread.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * @@ -36,9 +36,12 @@ SessionThread::SessionThread(UserId uid, bool restoreState, QObject *parent) } SessionThread::~SessionThread() { - // shut down thread gracefully - quit(); - wait(); + if(_session) { + _session->setParent(0); + _session->moveToThread(thread()); + _session->deleteLater(); + _session = 0; + } } CoreSession *SessionThread::session() { @@ -103,5 +106,13 @@ void SessionThread::run() { emit initialized(); exec(); delete _session; + _session = 0; } +void SessionThread::stopSession() { + if(_session) { + connect(_session, SIGNAL(destroyed()), this, SLOT(quit())); + _session->deleteLater(); + _session = 0; + } +}