Commit 7cdc7a70 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

DiscovererWorker: Initialize the FsHolder before starting the thread

This makes the member safe to read later on without any mutex since we
never write again to that variable
parent 0de00547
Pipeline #124860 passed with stage
in 6 minutes and 3 seconds
......@@ -45,13 +45,13 @@ namespace medialibrary
DiscovererWorker::DiscovererWorker(MediaLibrary* ml, FsHolder* fsHolder,
std::unique_ptr<FsDiscoverer> discoverer )
: m_currentTask( nullptr )
: m_fsHolder( fsHolder )
, m_currentTask( nullptr )
, m_run( true )
, m_discoverer( std::move( discoverer ) )
, m_ml( ml )
, m_thread( &DiscovererWorker::run, this )
, m_discoveryNotified( false )
, m_fsHolder( fsHolder )
{
/*
* We can't use a reference as we need a default constructor to be valid for
......
......@@ -108,6 +108,7 @@ private:
virtual void onDeviceDisappearing( int64_t deviceId ) override;
protected:
FsHolder* m_fsHolder;
std::list<Task> m_tasks;
Task* m_currentTask;
compat::Mutex m_mutex;
......@@ -118,7 +119,6 @@ protected:
MediaLibrary* m_ml;
compat::Thread m_thread;
bool m_discoveryNotified;
FsHolder* m_fsHolder;
friend std::ostream& operator<<( std::ostream& s, DiscovererWorker::Task::Type& t );
};
......
Supports Markdown
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