1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix profile saving on exit

This commit is contained in:
tux3 2015-06-04 12:14:17 +02:00
parent 3fd6d5d3e9
commit f7546a731f
4 changed files with 14 additions and 5 deletions

View File

@ -30,6 +30,7 @@
#include <tox/tox.h>
#include <ctime>
#include <cassert>
#include <limits>
#include <functional>
@ -103,8 +104,8 @@ Core::~Core()
{
qDebug() << "Deleting Core";
profile.saveToxSave();
toxTimer->stop();
QMetaObject::invokeMethod(this, "stopTimers", Qt::BlockingQueuedConnection);
delete toxTimer;
coreThread->exit(0);
while (coreThread->isRunning())
{
@ -1238,3 +1239,9 @@ void Core::resetCallSources()
}
}
}
void Core::stopTimers()
{
assert(QThread::currentThread() == coreThread);
toxTimer->stop();
}

View File

@ -285,12 +285,14 @@ private:
void deadifyTox();
private slots:
void stopTimers(); ///< Must only be called from the Core thread
private:
Tox* tox;
ToxAv* toxav;
QTimer *toxTimer, *fileTimer; //, *saveTimer;
QTimer *toxTimer;
Profile& profile;
int dhtServerId;
static ToxCall calls[TOXAV_MAX_CALLS];
#ifdef QTOX_FILTER_AUDIO
static AudioFilterer * filterer[TOXAV_MAX_CALLS];

View File

@ -64,6 +64,7 @@ Profile* Profile::createProfile(QString name, QString password)
Profile::~Profile()
{
saveToxSave();
delete core;
delete coreThread;
ProfileLocker::assertLock();

View File

@ -311,7 +311,6 @@ void ProfileForm::onDeleteClicked()
void ProfileForm::onLogoutClicked()
{
Nexus& nexus = Nexus::getInstance();
nexus.getProfile()->saveToxSave();
Settings::getInstance().save();
nexus.showLogin();
}