This repository was archived by the owner on Sep 4, 2026. It is now read-only.
Repository navigation
nil unsafe delegates and data sources at dealloc - #2
Merged
Merged
Conversation
This isn't a comprehensive review. There are probably some I missed. System objects with unsafe references to their delegates may outlive the lifetime of their delegates (eg when animating), sending messages to deallocated instances. To be safe, if you assign your object as a delegate to an unsafe delegate you also need to manually manage that unsafe reference and prevent it from outliving your object.
Contributor
There was a problem hiding this comment.
- (void)startTracking
{
if ([CLLocationManager locationServicesEnabled] == YES)
{
APCLogDebug(@"Start location tracking");-
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = nil;
self.locationManager.delegate = self;
-
just curious why you're allocating a whole new CLLocationManager every time you start and stop tracking, rather than creating it once and then starting/stopping SignificantLocationChanges as needed...?
Contributor
Author
There was a problem hiding this comment.
That'd be a valid approach as well. Easy to just check if self.locationManager isn't nil if you wanted to do it that way.
Member
|
Reviewed by Erin, merged. |
Erin-Mounts
added a commit
to Erin-Mounts/AppCore
that referenced
this pull request
Jun 24, 2015
Updates from shipping apps
YuanZhu-apple
pushed a commit
that referenced
this pull request
Jul 17, 2015
Refactor valueString methods
Erin-Mounts
added a commit
to Erin-Mounts/AppCore
that referenced
this pull request
Jul 31, 2015
…en_eligible_to_email_verification Add Share This App option in verify email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This isn't a comprehensive review. There are probably some I missed.
System objects with unsafe references to their delegates may outlive the
lifetime of their delegates (eg when animating), sending messages to
deallocated instances. To be safe, if you assign your object as a delegate
to an unsafe delegate you also need to manually manage that unsafe
reference and prevent it from outliving your object.