feathersui / feathersui-starling

User interface components for Starling Framework and Adobe AIR
https://feathersui.com/learn/as3-starling/
Other
914 stars 386 forks source link

Error #1009 on Scroller/focusOutHandler #1808

Open cgascons opened 3 years ago

cgascons commented 3 years ago

Hi, we are getting quite a few of these. This is the stack trace we were able to track from our players:

TypeError: Error #1009
at feathers.controls::Scroller/focusOutHandler()
at starling.events::EventDispatcher/invokeEvent()
at starling.events::EventDispatcher/dispatchEvent()
at starling.display::DisplayObject/dispatchEvent()
at starling.events::EventDispatcher/dispatchEventWith()
at feathers.core::DefaultFocusManager/set focus()
at feathers.core::DefaultFocusManager/topLevelContainer_touchHandler()
at starling.events::EventDispatcher/invokeEvent()
at starling.events::TouchEvent/dispatch()
at starling.events::Touch/dispatchEvent()
at starling.events::TouchProcessor/processTouches()
at starling.events::TouchProcessor/advanceTime()
at starling.core::Starling/advanceTime()
at starling.core::Starling/nextFrame()
at starling.core::Starling/onEnterFrame()

I'm not quite sure on how to replicate it, according to your code, Scroller's focusOutHandler function is quite simple and I believe only the fact that the player doesn't have a valid Stage would be able to cause this issue, right? Is there any way a safe check can be added here to avoid this issue?

joshtynjala commented 3 years ago

While you could add a check if the stage is null, it means that those listeners will not be removed. Luckily, I added those listeners as a weak reference, so it shouldn't cause a memory leak. Still, it's concerning. What you describe should not happen.

cgascons commented 3 years ago

I understand, it's definitely weird. This started happening since I last updated Feathers to the latest version, the previous version I had was: 3.1.2, I know, it was quite old so I took the chance and updated both Starling and Feathers to their latest versions.