diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 7656062f30..688997098a 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -1755,15 +1755,15 @@ void RiaApplication::initializeDataLoadController() const QString wellPathGeometryKeyword = "WELL_PATH_GEOMETRY"; dataLoadController->registerDataLoader( RimFileWellPath::classKeywordStatic(), wellPathGeometryKeyword, - std::make_shared() ); + std::make_unique() ); dataLoadController->registerDataLoader( RimOsduWellPath::classKeywordStatic(), wellPathGeometryKeyword, - std::make_shared() ); + std::make_unique() ); dataLoadController->registerDataLoader( RimModeledWellPath::classKeywordStatic(), wellPathGeometryKeyword, - std::make_shared() ); + std::make_unique() ); const QString wellLogKeyword = "WELL_LOG"; - dataLoadController->registerDataLoader( RimWellLogFile::classKeywordStatic(), wellLogKeyword, std::make_shared() ); - dataLoadController->registerDataLoader( RimOsduWellLog::classKeywordStatic(), wellLogKeyword, std::make_shared() ); + dataLoadController->registerDataLoader( RimWellLogFile::classKeywordStatic(), wellLogKeyword, std::make_unique() ); + dataLoadController->registerDataLoader( RimOsduWellLog::classKeywordStatic(), wellLogKeyword, std::make_unique() ); } diff --git a/Fwk/AppFwk/cafDataLoader/cafDataLoadController.cpp b/Fwk/AppFwk/cafDataLoader/cafDataLoadController.cpp index 5440eeeea3..04313323ae 100644 --- a/Fwk/AppFwk/cafDataLoader/cafDataLoadController.cpp +++ b/Fwk/AppFwk/cafDataLoader/cafDataLoadController.cpp @@ -68,12 +68,12 @@ DataLoadController* DataLoadController::instance() //-------------------------------------------------------------------------------------------------- void DataLoadController::registerDataLoader( const QString& objectType, const QString& dataType, - std::shared_ptr dataLoader ) + std::unique_ptr dataLoader ) { - std::pair key = { objectType, dataType }; - m_dataLoaders[key] = dataLoader; - dataLoader->taskDone.connect( this, &DataLoadController::onTaskFinished ); + + std::pair key = { objectType, dataType }; + m_dataLoaders[key] = std::move( dataLoader ); } //-------------------------------------------------------------------------------------------------- @@ -85,21 +85,19 @@ void DataLoadController::loadData( caf::PdmObject& object, const QString& dataTy auto it = m_dataLoaders.find( key ); if ( it != m_dataLoaders.end() ) { - std::shared_ptr dataLoader = it->second; - QMutexLocker locker( &m_mutex ); m_pendingTasksByType[dataType]++; locker.unlock(); - if ( dataLoader->isRunnable() ) + if ( it->second->isRunnable() ) { - DataLoadTask* task = new DataLoadTask( *this, *dataLoader.get(), object, dataType, m_taskId++, progressInfo ); + DataLoadTask* task = new DataLoadTask( *this, *it->second.get(), object, dataType, m_taskId++, progressInfo ); task->setAutoDelete( true ); QThreadPool::globalInstance()->start( task ); } else { - dataLoader->loadData( object, dataType, m_taskId++, progressInfo ); + it->second->loadData( object, dataType, m_taskId++, progressInfo ); } } } diff --git a/Fwk/AppFwk/cafDataLoader/cafDataLoadController.h b/Fwk/AppFwk/cafDataLoader/cafDataLoadController.h index ea40f7b44e..2ac62c7662 100644 --- a/Fwk/AppFwk/cafDataLoader/cafDataLoadController.h +++ b/Fwk/AppFwk/cafDataLoader/cafDataLoadController.h @@ -64,7 +64,7 @@ public: DataLoadController( const DataLoadController& ) = delete; DataLoadController& operator=( const DataLoadController& ) = delete; - void registerDataLoader( const QString& objectType, const QString& dataType, std::shared_ptr dataLoader ); + void registerDataLoader( const QString& objectType, const QString& dataType, std::unique_ptr dataLoader ); void loadData( caf::PdmObject& object, const QString& dateType, ProgressInfo& progressInfo ); @@ -75,7 +75,7 @@ public: private: DataLoadController(); - std::map, std::shared_ptr> m_dataLoaders; + std::map, std::unique_ptr> m_dataLoaders; std::map m_pendingTasksByType; int m_taskId;