Closed AdamHarte closed 2 years ago
hmmm, that is interesting, i would either expect all to crash, or none... i dont really understand what is different about the number stepper... ... ... unless... ... ... does it also happen with TextField
(it may be that haxeui tries to destroy the internal, flixel based, text input field before its been created) - ill check it out.
Cheers, Ian
I just tested all the basic components, and you are right. TextField does also have the issue. But that seems to be the only other component I have found. I have not tested any of the container components yet though.
Cool - so yeah, my guess is there is a bug in haxeui-flixel where its trying to destroy the native (well, native to openfl) text input before its made, should be a simple fix.
OK, this should be fixed now - if you are happy can you close this?
Cheers, Ian
Perfect! TextField and NumberStepper both can be removed now without any issue. Thanks for the super quick fix!
Having a basic XML layout with a
number-stepper
, then trying to remove that component usingremoveComponent
within the views constructor causes a Null access exception.Expected Behavior
For any other component, they will just be removed, so I would expect the NumberStepper to do the same.
Current Behavior
Error callstack:
Possible Solution
In
haxeui-flixel/haxe/ui/backend/ComponentImpl.hx
Line #941, there is a call toToolkit.callLater
. Inside the callback is_textInput.tf.visible = true;
. It seems that the component is deleted by the time this delayed call is fired, so either_textInput
or_textInput.tf
is null. If I change the callback to check for null then it works correct i.e.But I wonder if there are other places where the same issue could happen. I also wonder if cancelling the
callLater
before it fires is a better solution?Test app / minimal test case
PlayState.hx
Context
Maybe there is more of an appropriate way to do what I am doing. But all I really want to do is hide some elements of my layout before anything is shown on screen, based on various parameters in code.
Your Environment