Hi Guys,

I run today in weird scenario where I'm getting "maximum call stack size
exceeded" error. Following code makes freeze browser [1].

When my dataProvider is an empty ArrayList, DropDownListTextPrompt sets in
method forceSelection() selectedIndex to 0.[2]
ArrayListSelectionModel make selectedIndex = -1, cause dataProvider is
empty, but it also dispatch event "selectionChanged" [3].
Once that event is dispatched DropDownListTextPrompt receives it and call
again forceSelection method - It end up in a dead end.

In my opinion ArrayListSelectionModel shouldn't dispatch selectionChanged
if selectedIndex didn't change and this is the case.

Summarize everything.
dataProvider = new ArrayList(); -> empty.
1. selectedIndex is equal -1
2. selectedIndex is being set to 0

Due to empty dataProvider nothing has actually change, but even is being
dispatch.

Do you agree that it should be changed so ArrayListSelectionModel should
dispatch selectionChanged event when really something has changed ?

[1]  https://paste.apache.org/hil50
[2]
https://github.com/apache/royale-asjs/blob/50592b55565b4ad8aa776a7ded403da2d70d54a4/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/dropdownlist/RequireSelection.as#L124
[3]
https://github.com/apache/royale-asjs/blob/50592b55565b4ad8aa776a7ded403da2d70d54a4/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/ArrayListSelectionModel.as#L253

Thanks,
-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Reply via email to