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

Delete CoreAV's timer from the CoreAV thread

This commit is contained in:
tux3 2015-10-23 20:05:30 +02:00
parent 1f758efc2f
commit ae243b2089
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 10 additions and 1 deletions

View File

@ -62,7 +62,7 @@ CoreAV::~CoreAV()
{
for (const ToxFriendCall& call : calls)
cancelCall(call.callId);
stop();
killTimerFromThread();
toxav_kill(toxav);
}
@ -87,6 +87,14 @@ void CoreAV::stop()
iterateTimer->stop();
}
void CoreAV::killTimerFromThread()
{
// Timers can only be touched from their own thread
if (QThread::currentThread() != coreavThread.get())
return (void)QMetaObject::invokeMethod(this, "killTimerFromThread", Qt::BlockingQueuedConnection);
iterateTimer.release();
}
void CoreAV::process()
{
toxav_iterate(toxav);

View File

@ -98,6 +98,7 @@ private slots:
static void callCallback(ToxAV *toxAV, uint32_t friendNum, bool audio, bool video, void* self);
static void stateCallback(ToxAV *, uint32_t friendNum, uint32_t state, void* self);
static void bitrateCallback(ToxAV *toxAV, uint32_t friendNum, uint32_t arate, uint32_t vrate, void* self);
void killTimerFromThread(); ///< Calls itself blocking queued on the coreav thread
private:
void process();