* [ios] call image cliptoBounds in main thread
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5a082799 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5a082799 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5a082799 Branch: refs/heads/dev Commit: 5a0827998bc62cef3289d91a3bec6b099bcd7e85 Parents: 73dbdf0 Author: acton393 <zhangxing610...@gmail.com> Authored: Thu Sep 21 22:00:23 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Thu Sep 21 22:00:23 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5a082799/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m index bd31e97..b68f45a 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m @@ -29,6 +29,7 @@ #import "UIBezierPath+Weex.h" #import "WXSDKEngine.h" #import "WXUtility.h" +#import "WXAssert.h" #import <pthread/pthread.h> @interface WXImageView : UIImageView @@ -317,7 +318,10 @@ WX_EXPORT_METHOD(@selector(save:)) [super _frameDidCalculated:isChanged]; if ([self isViewLoaded] && isChanged) { - [self _clipsToBounds]; + __weak typeof(self) weakSelf = self; + WXPerformBlockOnMainThread(^{ + [weakSelf _clipsToBounds]; + }); } } @@ -490,6 +494,7 @@ WX_EXPORT_METHOD(@selector(save:)) - (void)_clipsToBounds { + WXAssertMainThread(); WXRoundedRect *borderRect = [[WXRoundedRect alloc] initWithRect:self.view.bounds topLeft:_borderTopLeftRadius topRight:_borderTopRightRadius bottomLeft:_borderBottomLeftRadius bottomRight:_borderBottomRightRadius]; // here is computed radii, do not use original style WXRadii *radii = borderRect.radii;