flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [1/2] git commit: Fix TypeError #1009 happening in dataProviderRefreshed() of List.as after refreshing the dataProvider of Combobox.
Date Wed, 27 Mar 2013 02:12:45 GMT
Updated Branches:
  refs/heads/develop 6282657e2 -> 39fdf7fa8


Fix TypeError #1009 happening in dataProviderRefreshed() of List.as after refreshing the dataProvider
of Combobox.


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/5ca083ea
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/5ca083ea
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/5ca083ea

Branch: refs/heads/develop
Commit: 5ca083ea6eaaf84ca7bcae4e8c4df98e59213ef5
Parents: 6282657
Author: Carlos Rovira <carlos.rovira@gmail.com>
Authored: Wed Mar 27 03:09:06 2013 +0100
Committer: Carlos Rovira <carlos.rovira@gmail.com>
Committed: Wed Mar 27 03:09:06 2013 +0100

----------------------------------------------------------------------
 .../projects/spark/src/spark/components/List.as    |   23 +++++++++++----
 1 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/5ca083ea/frameworks/projects/spark/src/spark/components/List.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/List.as b/frameworks/projects/spark/src/spark/components/List.as
index 1093007..84ac9e1 100644
--- a/frameworks/projects/spark/src/spark/components/List.as
+++ b/frameworks/projects/spark/src/spark/components/List.as
@@ -1458,7 +1458,7 @@ public class List extends ListBase implements IFocusManagerComponent
         // its x,y "offset" relative to the dataGroup's position and then scroll
         // so that the new caret item renderer appears at the same offset.
         
-        if ((caretItem !== undefined) && dataGroup && dataGroup.dataProvider)
+        if ((caretItem !== undefined) && (dataGroup != null) && dataGroup.dataProvider)
         {
             const newCaretIndex:int = dataGroup.dataProvider.getItemIndex(caretItem);
             const caretItemRenderer:IVisualElement = dataGroup.getElementAt(caretIndex);
@@ -1476,9 +1476,17 @@ public class List extends ListBase implements IFocusManagerComponent
                 // their responses to the refresh event.
                 
                 const updateCompleteListenerA:Function = function():void {
-                    dataGroup.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerA);
-                    ensureCaretVisibility(newCaretIndex);
-                    dataGroup.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerB);
                   
+					if(dataGroup != null)
+					{
+                    	dataGroup.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerA,
false);
+					}
+                    
+					ensureCaretVisibility(newCaretIndex);
+					
+					if(dataGroup != null)
+					{
+						dataGroup.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerB, false,
0, true);                    
+					}
                     
                 };
 
@@ -1486,11 +1494,14 @@ public class List extends ListBase implements IFocusManagerComponent
                 // so that layout bounds for the caret item renderer will have been computed.
                 
                 const updateCompleteListenerB:Function = function():void {
-                    dataGroup.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerB);
                   
+					if(dataGroup != null)
+					{
+						dataGroup.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerB, false);
                   
+					}
                     restoreCaretScrollPosition(newCaretIndex, caretOffsetX, caretOffsetY);
                 };
                 
-                dataGroup.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerA);
+                dataGroup.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteListenerA,
false, 0, true);
                 
                 return;
             }


Mime
View raw message