Commit 690cdb97 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Thumbnailer: Ensure a single thread will be created

Or rather that concurrent thumbnail request won't cause the 2nd thread
to call std::terminate
parent 60073666
Pipeline #5391 passed with stage
in 5 minutes and 40 seconds
......@@ -515,6 +515,8 @@ public:
* will be called.
* In case a thumbnail was already generated for the media, false will be returned.
* If so, no callback will be invoked
*
* This function is thread-safe
*/
virtual bool requestThumbnail( MediaPtr media ) = 0;
......
......@@ -54,10 +54,9 @@ ThumbnailerWorker::~ThumbnailerWorker()
void ThumbnailerWorker::requestThumbnail( MediaPtr media )
{
{
std::unique_lock<compat::Mutex> lock( m_mutex );
m_tasks.push( std::move( media ) );
}
std::unique_lock<compat::Mutex> lock( m_mutex );
m_tasks.push( std::move( media ) );
if ( m_thread.get_id() == compat::Thread::id{} )
{
m_run = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment