From d9e445d39ecda29f632b4b188331de942c9ec4ec Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sat, 28 Nov 2020 21:27:35 +1100 Subject: [PATCH] rendermanager: always create tickets in own thread --- app/render/rendermanager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/render/rendermanager.cpp b/app/render/rendermanager.cpp index 567b841d6..453445bbf 100644 --- a/app/render/rendermanager.cpp +++ b/app/render/rendermanager.cpp @@ -145,6 +145,10 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput* viewer, ColorManager* c ticket->setProperty("cache", cache->GetCacheDirectory()); } + if (ticket->thread() != this->thread()) { + ticket->moveToThread(this->thread()); + } + // Queue appending the ticket and running the next job on our thread to make this function thread-safe QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection, OLIVE_NS_ARG(RenderTicketPtr, ticket), @@ -169,6 +173,10 @@ RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange ticket->setProperty("waveforms", generate_waveforms); ticket->setProperty("aparam", QVariant::fromValue(params)); + if (ticket->thread() != this->thread()) { + ticket->moveToThread(this->thread()); + } + // Queue appending the ticket and running the next job on our thread to make this function thread-safe QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection, OLIVE_NS_ARG(RenderTicketPtr, ticket), @@ -187,6 +195,10 @@ RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr ticket->setProperty("hash", hash); ticket->setProperty("type", kTypeVideoDownload); + if (ticket->thread() != this->thread()) { + ticket->moveToThread(this->thread()); + } + // Queue appending the ticket and running the next job on our thread to make this function thread-safe QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection, OLIVE_NS_ARG(RenderTicketPtr, ticket),