cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [06/19] git commit: [CB-4825] avoid retain cycle in update block
Date Mon, 28 Oct 2013 22:11:43 GMT
[CB-4825] avoid retain cycle in update block


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/b2e17a78
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/b2e17a78
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/b2e17a78

Branch: refs/heads/master
Commit: b2e17a784a6d69a89410e661f3f9d76f0fcb4bc5
Parents: ea30406
Author: James Jong <wjamesjong@gmail.com>
Authored: Wed Oct 2 16:21:49 2013 -0400
Committer: James Jong <wjamesjong@gmail.com>
Committed: Wed Oct 2 16:21:49 2013 -0400

----------------------------------------------------------------------
 src/ios/CDVAccelerometer.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/b2e17a78/src/ios/CDVAccelerometer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVAccelerometer.m b/src/ios/CDVAccelerometer.m
index b338245..20bcbc6 100755
--- a/src/ios/CDVAccelerometer.m
+++ b/src/ios/CDVAccelerometer.m
@@ -66,12 +66,13 @@
     if ([self.motionManager isAccelerometerAvailable] == YES) {
         // Assign the update interval to the motion manager and start updates
         [self.motionManager setAccelerometerUpdateInterval:kAccelerometerInterval/1000];
 // expected in seconds
+        __weak CDVAccelerometer* weakSelf = self;
         [self.motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue mainQueue]
withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) {
             x = accelerometerData.acceleration.x;
             y = accelerometerData.acceleration.y;
             z = accelerometerData.acceleration.z;
             timestamp = ([[NSDate date] timeIntervalSince1970] * 1000);
-            [self returnAccelInfo];
+            [weakSelf returnAccelInfo];
         }];
 
         if (!self.isRunning) {


Mime
View raw message