CallOutgoing: fix crash on iPad

This commit is contained in:
Gautier Pelloux-Prayer 2016-02-09 10:23:32 +01:00
parent 4fd8f8ea45
commit f04db9985c

View file

@ -59,16 +59,16 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneCall *call = linphone_core_get_current_call(LC);
if (!call) {
[PhoneMainView.instance popCurrentView];
} else {
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *uri = linphone_address_as_string_uri_only(addr);
_addressLabel.text = [NSString stringWithUTF8String:uri];
ms_free(uri);
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
return;
}
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *uri = linphone_address_as_string_uri_only(addr);
_addressLabel.text = [NSString stringWithUTF8String:uri];
ms_free(uri);
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
[self hideSpeaker:LinphoneManager.instance.bluetoothAvailable];
[_speakerButton update];
@ -76,6 +76,17 @@ static UICompositeViewDescription *compositeDescription = nil;
[_routesButton update];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// if there is no call (for whatever reason), we must wait viewDidAppear method
// before popping current view, because UICompositeView cannot handle view change
// directly in viewWillAppear (this would lead to crash in deallocated memory - easily
// reproductible on iPad mini).
if (!linphone_core_get_current_call(LC)) {
[PhoneMainView.instance popCurrentView];
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[NSNotificationCenter.defaultCenter removeObserver:self];