Browse Source

Fix profile saving on exit

pull/1793/head
tux3 10 years ago
parent
commit
f7546a731f
  1. 11
      src/core/core.cpp
  2. 6
      src/core/core.h
  3. 1
      src/profile.cpp
  4. 1
      src/widget/form/profileform.cpp

11
src/core/core.cpp

@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
#include <tox/tox.h>
#include <ctime>
#include <cassert>
#include <limits>
#include <functional>
@ -103,8 +104,8 @@ Core::~Core() @@ -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() @@ -1238,3 +1239,9 @@ void Core::resetCallSources()
}
}
}
void Core::stopTimers()
{
assert(QThread::currentThread() == coreThread);
toxTimer->stop();
}

6
src/core/core.h

@ -285,12 +285,14 @@ private: @@ -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];

1
src/profile.cpp

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

1
src/widget/form/profileform.cpp

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

Loading…
Cancel
Save