feathersui / feathersui-openfl

Cross-platform graphical user interface components for creative frontend projects — powered by Haxe and OpenFL
https://feathersui.com/
Other
158 stars 15 forks source link

Exception: Null Object Reference - Clicking on Button #165

Open piotrzarzycki21 opened 4 months ago

piotrzarzycki21 commented 4 months ago

Another NPE in our application - it occurs much often when I'm clicking on Button. Code of that buttons is here - Button is created in following way

[2024-02-26 10:15:58][FATAL][Genesis/Source/genesis/application/GenesisApplication.hx:557] Fatal exception : Null Object Reference
Details : Exception: Null Object Reference
Called from openfl.text.TextField.__getBounds (openfl/text/TextField.hx line 1807)
Called from openfl.display.DisplayObject.getBounds (openfl/display/DisplayObject.hx line 1184)
Called from openfl.text.TextField.__updateScrollH (openfl/text/TextField.hx line 2304)
Called from openfl.text.TextField.setSelection (openfl/text/TextField.hx line 1380)
Called from openfl.text.TextField.__updateLayout (openfl/text/TextField.hx line 2264)
Called from openfl.text.TextField.get_textWidth (openfl/text/TextField.hx line 3048)
Called from feathers.controls.Button.refreshText (feathers/controls/Button.hx line 1061)
Called from feathers.controls.Button.commitChanges (feathers/controls/Button.hx line 769)
Called from feathers.controls.BasicButton.update (feathers/controls/BasicButton.hx line 223)
Called from genesis.application.components.GenesisButton.update (genesis/application/components/GenesisButton.hx line 46)
Called from feathers.core.ValidatingSprite.validateNow (feathers/core/ValidatingSprite.hx line 289)
Called from feathers.core.FeathersControl.validateNow (feathers/core/FeathersControl.hx line 715)
Called from feathers.controls.LayoutGroup.validateChildren (feathers/controls/LayoutGroup.hx line 900)
Called from feathers.controls.LayoutGroup.update (feathers/controls/LayoutGroup.hx line 568)
Called from feathers.core.ValidatingSprite.validateNow (feathers/core/ValidatingSprite.hx line 289)
Called from feathers.core.FeathersControl.validateNow (feathers/core/FeathersControl.hx line 715)
Called from feathers.controls.LayoutGroup.validateNow (feathers/controls/LayoutGroup.hx line 517)
Called from feathers.core.ValidationQueue.validateNow (feathers/core/ValidationQueue.hx line 156)
Called from feathers.core.ValidationQueue.validationQueue_stage_renderHandler (feathers/core/ValidationQueue.hx line 162)
Called from openfl.events.EventDispatcher.__dispatchEvent (openfl/events/EventDispatcher.hx line 426)
Called from openfl.display.DisplayObject.__dispatch (openfl/display/DisplayObject.hx line 1398)
Called from openfl.display.Stage.__broadcastEvent (openfl/display/Stage.hx line 1187)
Called from openfl.display.Stage.__render (openfl/display/Stage.hx line 2062)
Called from openfl.display.Stage.__onLimeRender (openfl/display/Stage.hx line 2186)
Called from lime.app._Event_lime_graphics_RenderContext_Void.dispatch (lime/_internal/macros/EventMacro.hx line 91)
Called from lime._internal.backend.native.NativeApplication.handleRenderEvent (lime/_internal/backend/native/NativeApplication.hx line 375)
Called from lime._internal.backend.native.NativeApplication.exec (lime/_internal/backend/native/NativeApplication.hx line 146)
Called from lime.app.Application.exec (lime/app/Application.hx line 150)
Called from openfl.display.Application.exec (openfl/display/Application.hx line 130)
Called from ApplicationMain.create (ApplicationMain.hx line 142)
Native : null
Stack : null
joshtynjala commented 4 months ago

Looks like another null value from Rectangle.__pool. This is probably a symptom of the same issue that caused #164.

piotrzarzycki21 commented 4 months ago

I got again crash today clicking on same Button, but stack trace look a bit different. Maybe it will be helpful.

[2024-02-28 09:54:05][FATAL][Genesis/Source/genesis/application/GenesisApplication.hx:557] Fatal exception : Null Object Reference
Details : Exception: Null Object Reference
Called from openfl.display.DisplayObject.__dispatchWithCapture (openfl/display/DisplayObject.hx line 1461)
Called from openfl.display.DisplayObject.dispatchEvent (openfl/display/DisplayObject.hx line 1134)
Called from feathers.events.FeathersEvent.dispatch (feathers/events/FeathersEvent.hx line 136)
Called from feathers.controls.dataRenderers.LayoutGroupItemRenderer.set_selected (feathers/controls/dataRenderers/LayoutGroupItemRenderer.hx line 129)
Called from feathers.controls.ListView.refreshItemRendererProperties (feathers/controls/ListView.hx line 1364)
Called from feathers.controls.ListView.updateItemRenderer (feathers/controls/ListView.hx line 1337)
Called from feathers.controls.ListView.findUnrenderedData (feathers/controls/ListView.hx line 1269)
Called from feathers.controls.ListView.refreshItemRenderers (feathers/controls/ListView.hx line 1151)
Called from feathers.controls.supportClasses.AdvancedLayoutViewPort.refreshLayout (feathers/controls/supportClasses/AdvancedLayoutViewPort.hx line 350)
Called from feathers.controls.supportClasses.AdvancedLayoutViewPort.update (feathers/controls/supportClasses/AdvancedLayoutViewPort.hx line 334)
Called from feathers.core.ValidatingSprite.runWithInvalidationFlagsOnly (feathers/core/ValidatingSprite.hx line 183)
Called from feathers.controls.supportClasses.AdvancedLayoutViewPort.update (feathers/controls/supportClasses/AdvancedLayoutViewPort.hx line 329)
Called from feathers.core.ValidatingSprite.validateNow (feathers/core/ValidatingSprite.hx line 289)
Called from feathers.core.FeathersControl.validateNow (feathers/core/FeathersControl.hx line 715)
Called from feathers.controls.supportClasses.BaseScrollContainer.refreshViewPort (feathers/controls/supportClasses/BaseScrollContainer.hx line 1294)
Called from feathers.controls.supportClasses.BaseScrollContainer.update (feathers/controls/supportClasses/BaseScrollContainer.hx line 1105)
Called from feathers.controls.ListView.update (feathers/controls/ListView.hx line 1071)
Called from feathers.core.ValidatingSprite.validateNow (feathers/core/ValidatingSprite.hx line 289)
Called from feathers.core.FeathersControl.validateNow (feathers/core/FeathersControl.hx line 715)
Called from feathers.core.ValidationQueue.validateNow (feathers/core/ValidationQueue.hx line 156)
Called from feathers.core.ValidationQueue.validationQueue_stage_renderHandler (feathers/core/ValidationQueue.hx line 162)
Called from openfl.events.EventDispatcher.__dispatchEvent (openfl/events/EventDispatcher.hx line 426)
Called from openfl.display.DisplayObject.__dispatch (openfl/display/DisplayObject.hx line 1398)
Called from openfl.display.Stage.__broadcastEvent (openfl/display/Stage.hx line 1187)
Called from openfl.display.Stage.__render (openfl/display/Stage.hx line 2062)
Called from openfl.display.Stage.__onLimeRender (openfl/display/Stage.hx line 2186)
Called from lime.app._Event_lime_graphics_RenderContext_Void.dispatch (lime/_internal/macros/EventMacro.hx line 91)
Called from lime._internal.backend.native.NativeApplication.handleRenderEvent (lime/_internal/backend/native/NativeApplication.hx line 375)
Called from lime._internal.backend.native.NativeApplication.exec (lime/_internal/backend/native/NativeApplication.hx line 146)
Called from lime.app.Application.exec (lime/app/Application.hx line 150)
Called from openfl.display.Application.exec (openfl/display/Application.hx line 130)
Called from ApplicationMain.create (ApplicationMain.hx line 142)
Native : null
Stack : null
joshtynjala commented 4 months ago

Interesting! That one also appears to be caused by an ObjectPool returning null, but it's a different ObjectPool this time. Perhaps this means it is a bug in the ObjectPool class.

piotrzarzycki21 commented 3 months ago

I just catch that exception in Moonshine debugger. Here is screenshot. Maybe it helps you at some point:

Screenshot 2024-03-21 at 13 35 01

I think stack var is null. Should I do something specific when I catch that again ?

joshtynjala commented 3 months ago

I just made this small change to ObjectPool in Lime: openfl/lime@5f63ef1ee35e1e2cc5a017769ed9ab0130c0502d

If you could try that change in ObjectPool with a debug build, that might help give us some clues.

piotrzarzycki21 commented 3 months ago

I just made this small change to ObjectPool in Lime: openfl/lime@5f63ef1

If you could try that change in ObjectPool with a debug build, that might help give us some clues.

Maybe it helped in a way that I got crash doing almost same thing - clicking on button, but exception looks different:

Screenshot 2024-03-22 at 12 55 40

In exception I see following classes ToastManager and Toast

piotrzarzycki21 commented 3 months ago

This one came next:

: [2024-03-22 15:29:21][FATAL][Genesis/Source/genesis/application/GenesisApplication.hx:557] Fatal exception : [lime.utils.ObjectPool] ERROR: Object has already been released
: Details : Exception: [lime.utils.ObjectPool] ERROR: Object has already been released
: Called from lime.utils.Log.error (lime/utils/Log.hx line 37)
: Called from lime.utils.ObjectPool.release (lime/utils/ObjectPool.hx line 106)
: Called from openfl.text.TextField.__getBounds (openfl/text/TextField.hx line 1813)
: Called from openfl.display.DisplayObject.getBounds (openfl/display/DisplayObject.hx line 1184)
: Called from openfl.text.TextField.__updateScrollH (openfl/text/TextField.hx line 2304)
: Called from openfl.text.TextField.setSelection (openfl/text/TextField.hx line 1380)
: Called from openfl.text.TextField.__updateLayout (openfl/text/TextField.hx line 2264)
: Called from openfl.text.TextField.get_textWidth (openfl/text/TextField.hx line 3048)
: Called from feathers.controls.Label.refreshText (feathers/controls/Label.hx line 749)
: Called from feathers.controls.Label.update (feathers/controls/Label.hx line 583)
: Called from feathers.core.ValidatingSprite.validateNow (feathers/core/ValidatingSprite.hx line 289)
: Called from feathers.core.FeathersControl.validateNow (feathers/core/FeathersControl.hx line 715)
: Called from feathers.core.ValidationQueue.validateNow (feathers/core/ValidationQueue.hx line 156)
: Called from feathers.core.ValidationQueue.validationQueue_stage_renderHandler (feathers/core/ValidationQueue.hx line 162)
: Called from openfl.events.EventDispatcher.__dispatchEvent (openfl/events/EventDispatcher.hx line 426)
: Called from openfl.display.DisplayObject.__dispatch (openfl/display/DisplayObject.hx line 1398)
: Called from openfl.display.Stage.__broadcastEvent (openfl/display/Stage.hx line 1187)
: Called from openfl.display.Stage.__render (openfl/display/Stage.hx line 2062)
: Called from openfl.display.Stage.__onLimeRender (openfl/display/Stage.hx line 2186)
: Called from lime.app._Event_lime_graphics_RenderContext_Void.dispatch (lime/_internal/macros/EventMacro.hx line 91)
: Called from lime._internal.backend.native.NativeApplication.handleRenderEvent (lime/_internal/backend/native/NativeApplication.hx line 375)
: Called from lime._internal.backend.native.NativeApplication.exec (lime/_internal/backend/native/NativeApplication.hx line 146)
: Called from lime.app.Application.exec (lime/app/Application.hx line 150)
: Called from openfl.display.Application.exec (openfl/display/Application.hx line 130)
: Called from ApplicationMain.create (ApplicationMain.hx line 142)
: Native : null
: Stack : null
: [2024-03-22 15:29:21][FATAL][Genesis/Source/genesis/application/GenesisApplication.hx:557] Fatal exception : [lime.utils.ObjectPool] ERROR: Object has already been released
: Details : Exception: [lime.utils.ObjectPool] ERROR: Object has already been released
: Called from lime.utils.Log.error (lime/utils/Log.hx line 37)
: Called from lime.utils.ObjectPool.release (lime/utils/ObjectPool.hx line 106)
: Called from openfl.text.TextField.__getBounds (openfl/text/TextField.hx line 1813)
: Called from openfl.display.DisplayObject.getBounds (openfl/display/DisplayObject.hx line 1184)
: Called from openfl.text.TextField.__updateScrollH (openfl/text/TextField.hx line 2304)
: Called from openfl.text.TextField.setSelection (openfl/text/TextField.hx line 1380)
: Called from openfl.text.TextField.__updateLayout (openfl/text/TextField.hx line 2264)
: Called from openfl.text.TextField.get_textWidth (openfl/text/TextField.hx line 3048)
: Called from feathers.controls.Label.refreshText (feathers/controls/Label.hx line 749)
: Called from feathers.controls.Label.update (feathers/controls/Label.hx line 583)
: Called from feathers.core.ValidatingSprite.validateNow (feathers/core/ValidatingSprite.hx line 289)
: Called from feathers.core.FeathersControl.validateNow (feathers/core/FeathersControl.hx line 715)
: Called from feathers.core.ValidationQueue.validateNow (feathers/core/ValidationQueue.hx line 156)
: Called from feathers.core.ValidationQueue.validationQueue_stage_renderHandler (feathers/core/ValidationQueue.hx line 162)
: Called from openfl.events.EventDispatcher.__dispatchEvent (openfl/events/EventDispatcher.hx line 426)
: Called from openfl.display.DisplayObject.__dispatch (openfl/display/DisplayObject.hx line 1398)
: Called from openfl.display.Stage.__broadcastEvent (openfl/display/Stage.hx line 1187)
: Called from openfl.display.Stage.__render (openfl/display/Stage.hx line 2062)
: Called from openfl.display.Stage.__onLimeRender (openfl/display/Stage.hx line 2186)
: Called from lime.app._Event_lime_graphics_RenderContext_Void.dispatch (lime/_internal/macros/EventMacro.hx line 91)
: Called from lime._internal.backend.native.NativeApplication.handleRenderEvent (lime/_internal/backend/native/NativeApplication.hx line 375)
: Called from lime._internal.backend.native.NativeApplication.exec (lime/_internal/backend/native/NativeApplication.hx line 146)
: Called from lime.app.Application.exec (lime/app/Application.hx line 150)
: Called from openfl.display.Application.exec (openfl/display/Application.hx line 130)
: Called from ApplicationMain.create (ApplicationMain.hx line 142)
piotrzarzycki21 commented 2 months ago

I just catch that exception in Moonshine debugger. Here is screenshot. Maybe it helps you at some point:

Screenshot 2024-03-21 at 13 35 01

I think stack var is null. Should I do something specific when I catch that again ?

@joshtynjala I got today exactly the same stacktrace. I'm using all your changes, feathers is updated to dev version and other libs as well.

joshtynjala commented 2 months ago

So far, I have been unable to reproduce any of the exceptions on my computer, and I can't think of anything else that I can try until we discover more clues. It is clear that this is related to the ObjectPool class in OpenFL, and I have tried various things to see if I could make an ObjectPool unexpectedly return null, but so far, I have been unsuccessful.