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:
parent
42a7efb053
commit
4e2983817f
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user