This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 6608a84859 Fix for invalid selectedIndex value for interim event 
listeners during removal of ViewStack child
6608a84859 is described below

commit 6608a84859efc9bf85b1e2f0964852136153826f
Author: greg-dove <[email protected]>
AuthorDate: Tue Sep 27 16:21:23 2022 +1300

    Fix for invalid selectedIndex value for interim event listeners during 
removal of ViewStack child
---
 .../projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
index ca9a9c8bff..a1f27b366b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
@@ -1494,8 +1494,16 @@ public class ViewStack extends Container implements 
/*IHistoryManagerClient,*/ I
     override public function removeElement(c:IChild, dispatchEvent:Boolean = 
true):void
     {
         var index:int = getElementIndex(c);
+        //the following is a quick fix for now, the selectedIndex is only 
"corrected" in childRemoveHandler, so temporarily set it to invalid for 
intermediate listeners
+        if (index <= selectedIndex) {
+            var repair:Boolean = true;
+             _selectedIndex = -1;
+        }
         super.removeElement(c, dispatchEvent);
         internalDispatchEvent(CollectionEventKind.REMOVE, c, index);
+        if (repair) {
+            _selectedIndex = index;
+        }
         childRemoveHandler(c as IUIComponent, index);
     }
 

Reply via email to