You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/05/02 00:19:12 UTC

ios commit: Killed a zombie. After the heading update was stopped, we don't set the delegate to nil, so we continue to get updates.

Updated Branches:
  refs/heads/master 7b4029766 -> e70991c6b


Killed a zombie. After the heading update was stopped, we don't set the delegate to nil, so we continue to get updates.

… but of course we can't set it to nil, since we share the CLLocationManager class with location updates, so we do a simple nil check, and make the property atomic.


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

Branch: refs/heads/master
Commit: e70991c6bd53511e8ee02c7b6f9aae1b7caab4f1
Parents: 7b40297
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue May 1 15:19:03 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue May 1 15:19:03 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVLocation.h |    2 +-
 CordovaLib/Classes/CDVLocation.m |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e70991c6/CordovaLib/Classes/CDVLocation.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.h b/CordovaLib/Classes/CDVLocation.h
index ba0a4d2..7f47bf4 100755
--- a/CordovaLib/Classes/CDVLocation.h
+++ b/CordovaLib/Classes/CDVLocation.h
@@ -65,7 +65,7 @@ typedef NSUInteger CDVLocationStatus;
 }
 
 @property (nonatomic, retain) CLLocationManager *locationManager;
-@property (nonatomic, retain) CDVHeadingData* headingData;
+@property (retain) CDVHeadingData* headingData;
 @property (nonatomic, retain) CDVLocationData* locationData;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e70991c6/CordovaLib/Classes/CDVLocation.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocation.m b/CordovaLib/Classes/CDVLocation.m
index 64233d2..75a7ab7 100755
--- a/CordovaLib/Classes/CDVLocation.m
+++ b/CordovaLib/Classes/CDVLocation.m
@@ -506,6 +506,14 @@
         didUpdateHeading:(CLHeading *)heading
 {
     CDVHeadingData* hData = self.headingData;
+    
+    // normally we would clear the delegate to stop getting these notifications, but
+    // we are sharing a CLLocationManager to get location data as well, so we do a nil check here
+    // ideally heading and location should use their own CLLocationManager instances
+    if (hData == nil) {
+        return;
+    }
+    
     // save the data for next call into getHeadingData
     hData.headingInfo = heading;
     BOOL bTimeout = NO;