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

Fix crash in ~Core

This commit is contained in:
tux3 2015-06-04 14:31:13 +02:00
parent 42a7efb053
commit 4e2983817f
2 changed files with 4 additions and 4 deletions

View File

@ -107,11 +107,10 @@ Core::~Core()
if (coreThread->isRunning()) if (coreThread->isRunning())
{ {
if (QThread::currentThread() == coreThread) if (QThread::currentThread() == coreThread)
stopTimers(); killTimers();
else else
QMetaObject::invokeMethod(this, "stopTimers", Qt::BlockingQueuedConnection); QMetaObject::invokeMethod(this, "stopTimers", Qt::BlockingQueuedConnection);
} }
delete toxTimer;
coreThread->exit(0); coreThread->exit(0);
while (coreThread->isRunning()) while (coreThread->isRunning())
{ {
@ -1248,8 +1247,9 @@ void Core::resetCallSources()
} }
} }
void Core::stopTimers() void Core::killTimers()
{ {
assert(QThread::currentThread() == coreThread); assert(QThread::currentThread() == coreThread);
toxTimer->stop(); toxTimer->stop();
delete toxTimer;
} }

View File

@ -286,7 +286,7 @@ private:
void deadifyTox(); void deadifyTox();
private slots: private slots:
void stopTimers(); ///< Must only be called from the Core thread void killTimers(); ///< Must only be called from the Core thread
private: private:
Tox* tox; Tox* tox;