incubator-weex git commit: * [iOS] fix multithread crash about mutable array in scroller component [Forced Update!]

2018-03-08 Thread toretto
Repository: incubator-weex
Updated Branches:
  refs/heads/master 9c9ae8846 -> ec0a1f9ba (forced update)


* [iOS] fix multithread crash about mutable array in scroller component


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ec0a1f9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ec0a1f9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ec0a1f9b

Branch: refs/heads/master
Commit: ec0a1f9ba29720f3b3559edc06bcfae855d28553
Parents: 4b0e374
Author: acton393 
Authored: Thu Mar 8 15:27:44 2018 +0800
Committer: yuhun-alibaba 
Committed: Thu Mar 8 19:19:32 2018 +0800

--
 ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ec0a1f9b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
--
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m 
b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index 4ebaec5..ede9de3 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -28,6 +28,7 @@
 #import "WXRefreshComponent.h"
 #import "WXConfigCenterProtocol.h"
 #import "WXSDKEngine.h"
+#import "WXThreadSafeMutableArray.h"
 
 @interface WXScrollerComponnetView:UIScrollView
 @end
@@ -50,7 +51,7 @@
 @interface WXScrollerComponent()
 
 @property (nonatomic, strong) NSMutableArray *  stickyArray;
-@property (nonatomic, strong) NSMutableArray *  listenerArray;
+@property (nonatomic, strong) WXThreadSafeMutableArray * listenerArray;
 @property (nonatomic, weak) WXRefreshComponent *refreshComponent;
 @property (nonatomic, weak) WXLoadingComponent *loadingComponent;
 
@@ -118,7 +119,7 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 if (self) {
 
 _stickyArray = [NSMutableArray array];
-_listenerArray = [NSMutableArray array];
+_listenerArray = [WXThreadSafeMutableArray array];
 _scrollEvent = NO;
 _scrollStartEvent = NO;
 _scrollEndEvent = NO;
@@ -382,7 +383,8 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 - (void)addScrollToListener:(WXComponent *)target
 {
 BOOL has = NO;
-for (WXScrollToTarget *targetData in self.listenerArray) {
+WXThreadSafeMutableArray *listenerArray = [self.listenerArray copy];
+for (WXScrollToTarget *targetData in listenerArray) {
 if (targetData.target == target) {
 has = YES;
 break;
@@ -400,7 +402,8 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 {
 if (_shouldRemoveScrollerListener) {
 WXScrollToTarget *targetData = nil;
-for (WXScrollToTarget *targetDataTemp in self.listenerArray) {
+WXThreadSafeMutableArray *listenerArray = [self.listenerArray copy];
+for (WXScrollToTarget *targetDataTemp in listenerArray) {
 if (targetDataTemp.target == target) {
 targetData = targetDataTemp;
 break;



incubator-weex git commit: * [iOS] fix multithread crash about mutable array in scroller component

2018-03-07 Thread acton393
Repository: incubator-weex
Updated Branches:
  refs/heads/master 7c5ef1c68 -> 9c9ae8846


* [iOS] fix multithread crash about mutable array in scroller component


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9c9ae884
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9c9ae884
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9c9ae884

Branch: refs/heads/master
Commit: 9c9ae884659682882ba2803906a0116556377859
Parents: 7c5ef1c
Author: acton393 
Authored: Thu Mar 8 15:27:44 2018 +0800
Committer: acton393 
Committed: Thu Mar 8 15:28:34 2018 +0800

--
 ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9c9ae884/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
--
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m 
b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index 4ebaec5..ede9de3 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -28,6 +28,7 @@
 #import "WXRefreshComponent.h"
 #import "WXConfigCenterProtocol.h"
 #import "WXSDKEngine.h"
+#import "WXThreadSafeMutableArray.h"
 
 @interface WXScrollerComponnetView:UIScrollView
 @end
@@ -50,7 +51,7 @@
 @interface WXScrollerComponent()
 
 @property (nonatomic, strong) NSMutableArray *  stickyArray;
-@property (nonatomic, strong) NSMutableArray *  listenerArray;
+@property (nonatomic, strong) WXThreadSafeMutableArray * listenerArray;
 @property (nonatomic, weak) WXRefreshComponent *refreshComponent;
 @property (nonatomic, weak) WXLoadingComponent *loadingComponent;
 
@@ -118,7 +119,7 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 if (self) {
 
 _stickyArray = [NSMutableArray array];
-_listenerArray = [NSMutableArray array];
+_listenerArray = [WXThreadSafeMutableArray array];
 _scrollEvent = NO;
 _scrollStartEvent = NO;
 _scrollEndEvent = NO;
@@ -382,7 +383,8 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 - (void)addScrollToListener:(WXComponent *)target
 {
 BOOL has = NO;
-for (WXScrollToTarget *targetData in self.listenerArray) {
+WXThreadSafeMutableArray *listenerArray = [self.listenerArray copy];
+for (WXScrollToTarget *targetData in listenerArray) {
 if (targetData.target == target) {
 has = YES;
 break;
@@ -400,7 +402,8 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 {
 if (_shouldRemoveScrollerListener) {
 WXScrollToTarget *targetData = nil;
-for (WXScrollToTarget *targetDataTemp in self.listenerArray) {
+WXThreadSafeMutableArray *listenerArray = [self.listenerArray copy];
+for (WXScrollToTarget *targetDataTemp in listenerArray) {
 if (targetDataTemp.target == target) {
 targetData = targetDataTemp;
 break;