Browse Source

Delete CoreAV's timer from the CoreAV thread

pull/2476/head
tux3 10 years ago
parent
commit
ae243b2089
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 10
      src/core/coreav.cpp
  2. 1
      src/core/coreav.h

10
src/core/coreav.cpp

@ -62,7 +62,7 @@ CoreAV::~CoreAV() @@ -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() @@ -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);

1
src/core/coreav.h

@ -98,6 +98,7 @@ private slots: @@ -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…
Cancel
Save