Commit 9ba0ea93 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaLibrary: Make discovery asynchronous

parent 337cd9b7
......@@ -60,7 +60,7 @@ class IMediaLibrary
* @brief discover Launch a discovery on the provided entry point.
* There no garanty on how this will be processed, or if it will be processed synchronously or not.
* The actuall discovery will run asynchronously, meaning this method will immediatly return.
* Depending on which discoverer modules where provided, this might or might not work
* @param entryPoint What to discover.
......@@ -217,8 +217,14 @@ void MediaLibrary::addMetadataService(std::unique_ptr<IMetadataService> service)
void MediaLibrary::discover( const std::string &entryPoint )
for ( auto& d : m_discoverers )
d->discover( entryPoint );
std::thread t([this, entryPoint] {
//FIXME: This will crash if the media library gets deleted while we
//are discovering.
for ( auto& d : m_discoverers )
d->discover( entryPoint );
FolderPtr MediaLibrary::onNewFolder( const fs::IDirectory* directory, FolderPtr parent )
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