Browse Source

Merge pull request #9603 from bghgary/gltf-error-fix

Fix unhandled exception leak in glTF loader
David Catuhe 4 năm trước cách đây
mục cha
commit
7a3635aedf
2 tập tin đã thay đổi với 4 bổ sung5 xóa
  1. 3 3
      loaders/src/glTF/2.0/glTFLoader.ts
  2. 1 2
      src/Loading/sceneLoader.ts

+ 3 - 3
loaders/src/glTF/2.0/glTFLoader.ts

@@ -343,7 +343,7 @@ export class GLTFLoader implements IGLTFLoader {
                 return resultFunc();
             });
 
-            resultPromise.then(() => {
+            return resultPromise.then((result) => {
                 this._parent._endPerformanceCounter(loadingToReadyCounterName);
 
                 Tools.SetImmediate(() => {
@@ -365,9 +365,9 @@ export class GLTFLoader implements IGLTFLoader {
                         });
                     }
                 });
-            });
 
-            return resultPromise;
+                return result;
+            });
         }).catch((error) => {
             if (!this._disposed) {
                 this._parent.onErrorObservable.notifyObservers(error);

+ 1 - 2
src/Loading/sceneLoader.ts

@@ -791,8 +791,7 @@ export class SceneLoader {
                 });
             }, onProgress, (scene, message, exception) => {
                 reject(exception || new Error(message));
-            },
-                pluginExtension);
+            }, pluginExtension);
         });
     }