diff --git a/haxe/ui/backend/ScreenImpl.hx b/haxe/ui/backend/ScreenImpl.hx index f9fe7d6..9cdc515 100644 --- a/haxe/ui/backend/ScreenImpl.hx +++ b/haxe/ui/backend/ScreenImpl.hx @@ -213,6 +213,7 @@ class ScreenImpl extends ScreenBase { throw "component wasnt actually removed from array, or there is a duplicate in the array"; } if (dispose) { + component.state = null; component.destroyInternal(); component.destroy(); component.destroyComponent(); @@ -222,7 +223,6 @@ class ScreenImpl extends ScreenBase { if (StateHelper.currentState.exists == true) { StateHelper.currentState.remove(component, true); } - component.state = null; checkResetCursor(); onContainerResize(); return component;