You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/11/16 14:11:34 UTC

[1/2] incubator-weex git commit: [WEEX-105][iOS] bug-fix about setting nan frame crash

Repository: incubator-weex
Updated Branches:
  refs/heads/master 900967124 -> dd8b7e1a8


[WEEX-105][iOS] bug-fix about setting nan frame crash

try to protect nan crash when set frame containing nan value.
Last Exception Backtrace:
0   CoreFoundation                  0x00000001830301c0 __exceptionPreprocess :124 (in CoreFoundation)
1   libobjc.A.dylib                 0x0000000181a6855c _objc_exception_throw :56 (in libobjc.A.dylib)
2   CoreFoundation                  0x0000000183030108 +[NSException raise:format:] :116 (in CoreFoundation)
3   QuartzCore                      0x0000000186335db8 CA::Layer::set_position(CA::Vec2 const&, bool) :152 (in QuartzCore)
4   QuartzCore                      0x0000000186335f2c -[CALayer setPosition:] :40 (in QuartzCore)
5   QuartzCore                      0x00000001863364c4 -[CALayer setFrame:] :448 (in QuartzCore)
6   UIKit                           0x0000000188e71e2c -[UIView(Geometry) setFrame:] :784 (in UIKit)
7   Taobao4iPhone                   0x0000000102d6ad4c _43-[WXComponent(Layout) _frameDidCalculated:]_block_invoke WXComponent+Layout.m:136

Last Exception Backtrace 2:
0   CoreFoundation                  0x0000000185b12fe0 __exceptionPreprocess :124 (in CoreFoundation)
1   libobjc.A.dylib                 0x0000000184574538 _objc_exception_throw :56 (in libobjc.A.dylib)
2   CoreFoundation                  0x0000000185b12f28 +[NSException raise:format:] :116 (in CoreFoundation)
3   QuartzCore                      0x0000000188e29798 CA::Layer::set_bounds(CA::Rect const&, bool) :204 (in QuartzCore)
4   QuartzCore                      0x0000000188e299e0 -[CALayer setBounds:] :100 (in QuartzCore)
5   UIKit                           0x000000018bc908c8 -[UIView(Geometry) setBounds:] :404 (in UIKit)
6   UIKit                           0x000000018bc9eacc -[UIScrollView setBounds:] :988 (in UIKit)
7   UIKit                           0x000000018bd271c8 -[UITableView setBounds:] :224 (in UIKit)
8   UIKit                           0x000000018bc62828 -[UIScrollView setContentOffset:] :400 (in UIKit)
9   UIKit                           0x000000018bd191dc -[UITableView setContentOffset:] :272 (in UIKit)
10  Taobao4iPhone                   0x0000000102d7b6e8 -[WXTableView setContentOffset:] WXListComponent.m:63 (in Taobao4iPhone)
11  UIKit                           0x000000018bde6d08 -[UIScrollView _updatePanGesture] :1988 (in UIKit)
12  UIKit                           0x000000018c2168d0 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] :64 (in UIKit)
13  UIKit                           0x000000018c21a104 _UIGestureRecognizerSendTargetActions :124 (in UIKit)
14  UIKit                           0x000000018bdd40b4 _UIGestureRecognizerSendActions :252 (in UIKit)

Bug: 105


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

Branch: refs/heads/master
Commit: 784fd75d324c2034a362a79251a87c295eb9fbea
Parents: d731f4d
Author: acton393 <zh...@gmail.com>
Authored: Mon Nov 13 15:08:15 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Nov 13 15:08:15 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXListComponent.m | 6 ++++++
 ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/784fd75d/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index 7c4fe68..ddfaf6f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -58,6 +58,12 @@
     if (fabs(contentOffset.y) < 0.5) {
         contentOffset.y = 0;
     }
+    if (isnan(contentOffset.x)) {
+        contentOffset.x = 0;
+    }
+    if(isnan(contentOffset.y)) {
+        contentOffset.y = 0;
+    }
     
     [super setContentOffset:contentOffset];
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/784fd75d/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
index adf1652..44aef1c 100644
--- a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
+++ b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
@@ -166,10 +166,10 @@
     _cssNode->layout.should_update = false;
     _isLayoutDirty = NO;
     
-    CGRect newFrame = CGRectMake(WXRoundPixelValue(_cssNode->layout.position[CSS_LEFT]),
-                                 WXRoundPixelValue(_cssNode->layout.position[CSS_TOP]),
-                                 WXRoundPixelValue(_cssNode->layout.dimensions[CSS_WIDTH]),
-                                 WXRoundPixelValue(_cssNode->layout.dimensions[CSS_HEIGHT]));
+    CGRect newFrame = CGRectMake(isnan(WXRoundPixelValue(_cssNode->layout.position[CSS_LEFT]))?0:WXRoundPixelValue(_cssNode->layout.position[CSS_LEFT]),
+                                 isnan(WXRoundPixelValue(_cssNode->layout.position[CSS_TOP]))?0:WXRoundPixelValue(_cssNode->layout.position[CSS_TOP]),
+                                 isnan(WXRoundPixelValue(_cssNode->layout.dimensions[CSS_WIDTH]))?0:WXRoundPixelValue(_cssNode->layout.dimensions[CSS_WIDTH]),
+                                 isnan(WXRoundPixelValue(_cssNode->layout.dimensions[CSS_HEIGHT]))?0:WXRoundPixelValue(_cssNode->layout.dimensions[CSS_HEIGHT]));
     
     BOOL isFrameChanged = NO;
     if (!CGRectEqualToRect(newFrame, _calculatedFrame)) {


[2/2] incubator-weex git commit: [WEEX-105][iOS] bug-fix about setting nan frame crash

Posted by gu...@apache.org.
[WEEX-105][iOS] bug-fix about setting nan frame crash


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

Branch: refs/heads/master
Commit: dd8b7e1a846915395de8de957a53ebf5a1d5d541
Parents: 9009671 784fd75
Author: gurisxie <27...@qq.com>
Authored: Thu Nov 16 22:10:53 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Thu Nov 16 22:10:59 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXListComponent.m | 6 ++++++
 ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------