Skip to content

Commit

Permalink
Merge pull request #7136 from cheekiatng/timob-19473_5_0_X
Browse files Browse the repository at this point in the history
[TIMOB-19473](5_0_X) iOS9: Fix memory issues in Contacts and Geolocation Modules
  • Loading branch information
hansemannn committed Sep 9, 2015
2 parents cce2651 + 84bee9a commit 2ccbf66
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions iphone/Classes/ContactsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ -(void)dealloc
RELEASE_TO_NIL(contactKeysWithImage)
#if IS_XCODE_7
RELEASE_TO_NIL(contactStore)
RELEASE_TO_NIL(saveRequest)
saveRequest = nil;
RELEASE_TO_NIL(contactPicker)
[[NSNotificationCenter defaultCenter] removeObserver:self name:CNContactStoreDidChangeNotification object:nil];
#endif
Expand Down Expand Up @@ -301,7 +301,7 @@ -(void)save:(id)unused
subreason:nil
location:CODELOCATION];
};
RELEASE_TO_NIL(saveRequest)
saveRequest = nil;
return;
}
#endif
Expand Down Expand Up @@ -769,7 +769,7 @@ -(void)removePerson:(id)arg
#if IS_XCODE_7
if([TiUtils isIOS9OrGreater]) {
TiContactsPerson *person = arg;
RELEASE_TO_NIL(saveRequest)
saveRequest = nil;
saveRequest = [person getSaveRequestForDeletion];
return;
}
Expand Down Expand Up @@ -856,7 +856,7 @@ -(void)removeGroup:(id)arg
#if IS_XCODE_7
if([TiUtils isIOS9OrGreater]) {
TiContactsGroup *group = arg;
RELEASE_TO_NIL(saveRequest)
saveRequest = nil;
saveRequest = [group getSaveRequestForDeletion];
return;
}
Expand Down
8 changes: 6 additions & 2 deletions iphone/Classes/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -535,21 +535,25 @@ -(void)performGeo:(NSString*)direction address:(NSString*)address callback:(Geol
-(void)reverseGeocoder:(id)args
{
ENSURE_ARG_COUNT(args,3);
CGFloat lat = [TiUtils floatValue:[args objectAtIndex:0]];
CGFloat lon = [TiUtils floatValue:[args objectAtIndex:1]];
KrollCallback *callback = [args objectAtIndex:2];
ENSURE_TYPE(callback,KrollCallback);
#ifndef __clang_analyzer__ //ignore static analyzer error here, memory will be released
CGFloat lat = [TiUtils floatValue:[args objectAtIndex:0]];
CGFloat lon = [TiUtils floatValue:[args objectAtIndex:1]];
ReverseGeoCallback *rcb = [[ReverseGeoCallback alloc] initWithCallback:callback context:[self executionContext]];
[self performGeo:@"r" address:[NSString stringWithFormat:@"%f,%f",lat,lon] callback:rcb];
#endif
}

-(void)forwardGeocoder:(id)args
{
ENSURE_ARG_COUNT(args,2);
KrollCallback *callback = [args objectAtIndex:1];
ENSURE_TYPE(callback,KrollCallback);
#ifndef __clang_analyzer__ //ignore static analyzer error here, memory will be released
ForwardGeoCallback *fcb = [[ForwardGeoCallback alloc] initWithCallback:callback context:[self executionContext]];
[self performGeo:@"f" address:[TiUtils stringValue:[args objectAtIndex:0]] callback:fcb];
#endif
}

-(void)getCurrentHeading:(id)callback
Expand Down
4 changes: 2 additions & 2 deletions iphone/Classes/TiContactsPerson.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ -(id)_initWithPageContext:(id<TiEvaluator>)context contactId:(CNMutableContact*)
#endif
-(void)dealloc
{
RELEASE_TO_NIL(iOS9contactProperties)
iOS9contactProperties = nil;
[super dealloc];
}

Expand Down Expand Up @@ -301,7 +301,7 @@ +(NSDictionary*)iOS9multiValueLabels
}
-(void)updateiOS9ContactProperties
{
RELEASE_TO_NIL(iOS9contactProperties)
iOS9contactProperties = nil;
[self getiOS9ContactProperties:person];
}
#endif
Expand Down

0 comments on commit 2ccbf66

Please sign in to comment.