Browse Source

Fixed crash when Entity.Destroy() called multiple times.

Mark Sibly 7 years ago
parent
commit
9b1aff030b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      modules/mojo3d/scene/entity.monkey2

+ 3 - 3
modules/mojo3d/scene/entity.monkey2

@@ -381,15 +381,15 @@ Class Entity Abstract
 	#end
 	#end
 	Method Destroy()
 	Method Destroy()
 		
 		
+		If _state=State.Destroyed Return
+		
 		If _scene.Updating
 		If _scene.Updating
-			If _state<>State.Active Return
+			If _state=State.Destroying Return
 			_state=State.Destroying
 			_state=State.Destroying
 			_scene.UpdateFinished+=Destroy
 			_scene.UpdateFinished+=Destroy
 			Return
 			Return
 		End
 		End
 		
 		
-		If _state=State.Destroyed Return
-		
 		_state=State.Destroyed
 		_state=State.Destroyed
 		
 		
 		While Not _children.Empty
 		While Not _children.Empty