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:
parent
1f758efc2f
commit
ae243b2089
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user