(Scene3D) Always create ModelLoader at main thread 84/319184/5
authorEunki Hong <eunkiki.hong@samsung.com>
Thu, 17 Oct 2024 03:01:02 +0000 (12:01 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Mon, 4 Nov 2024 06:00:06 +0000 (15:00 +0900)
Until now, Dali::Scene3D::Loader::ModelLoader create at worker thread.
It might make some problem when we try to load usd model, and call dlopen.

To avoid those kind of issue, let we make it create at ModelLoadTask constructor
(Which will be call at main thread always).

Change-Id: I801f31a6940c9f3267a39d596e123683da9700bb
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
dali-scene3d/internal/common/model-load-task.cpp

index 75df573277e5d2d382468e293fccd03c6b94873d..8b9c171fe06df4bcafae3d2cf0252d60288b9a83 100644 (file)
@@ -62,10 +62,20 @@ ModelLoadTask::ModelLoadTask(const std::string& modelUrl, const std::string& res
   mHasSucceeded(false)
 {
   mModelCacheManager.ReferenceModelCache(mModelUrl);
+
+  if(mResourceDirectoryUrl.empty())
+  {
+    std::filesystem::path modelUrl(mModelUrl);
+    mResourceDirectoryUrl = std::string(modelUrl.parent_path()) + "/";
+  }
+
+  mModelLoader = std::make_unique<Dali::Scene3D::Loader::ModelLoader>(mModelUrl, mResourceDirectoryUrl, mLoadResult);
 }
 
 ModelLoadTask::~ModelLoadTask()
 {
+  mModelLoader.reset();
+
   mModelCacheManager.UnreferenceModelCache(mModelUrl);
 }
 
@@ -81,18 +91,10 @@ void ModelLoadTask::Process()
   }
 #endif
 
-  if(mResourceDirectoryUrl.empty())
-  {
-    std::filesystem::path modelUrl(mModelUrl);
-    mResourceDirectoryUrl = std::string(modelUrl.parent_path()) + "/";
-  }
-
   Dali::Scene3D::Loader::ResourceBundle::PathProvider pathProvider = [&](Dali::Scene3D::Loader::ResourceType::Value type) {
     return mResourceDirectoryUrl;
   };
 
-  mModelLoader = std::make_unique<Dali::Scene3D::Loader::ModelLoader>(mModelUrl, mResourceDirectoryUrl, mLoadResult);
-
   bool loadSucceeded = false;
 
 #ifdef TRACE_ENABLED