Browse Source

Merge pull request #6616 from zakhenry/fix/scene-dispose-check-is-ready-timer

fix(Scene): Dispose of timer that may not have been cleared if the scene was never ready.
David Catuhe 6 năm trước cách đây
mục cha
commit
354964b9ee
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      src/scene.ts

+ 6 - 0
src/scene.ts

@@ -1860,6 +1860,12 @@ export class Scene extends AbstractScene implements IAnimatable {
             return;
         }
 
+        if (this._isDisposed) {
+            this.onReadyObservable.clear();
+            this._executeWhenReadyTimeoutId = -1;
+            return;
+        }
+
         this._executeWhenReadyTimeoutId = setTimeout(() => {
             this._checkIsReady();
         }, 150);