do not crash after destroying linphone core

This commit is contained in:
Benjamin Reis 2017-09-29 10:09:45 +02:00
parent 47343025a3
commit 8432847288
3 changed files with 42 additions and 12 deletions

View file

@ -192,17 +192,27 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)coreUpdateEvent:(NSNotification *)notif {
if (IPAD) {
if (linphone_core_video_display_enabled(LC) && linphone_core_video_preview_enabled(LC)) {
linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview));
[_backgroundView setHidden:FALSE];
[_videoCameraSwitch setHidden:FALSE];
} else {
linphone_core_set_native_preview_window_id(LC, NULL);
[_backgroundView setHidden:TRUE];
[_videoCameraSwitch setHidden:TRUE];
@try {
if (IPAD) {
if (linphone_core_video_display_enabled(LC) && linphone_core_video_preview_enabled(LC)) {
linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview));
[_backgroundView setHidden:FALSE];
[_videoCameraSwitch setHidden:FALSE];
} else {
linphone_core_set_native_preview_window_id(LC, NULL);
[_backgroundView setHidden:TRUE];
[_videoCameraSwitch setHidden:TRUE];
}
}
}
@catch (NSException *exception) {
if ([exception.name isEqualToString:@"LinphoneCoreException"]) {
LOGE(@"Core already destroyed");
return;
}
LOGE(@"Uncaught exception : %@", exception.description);
abort();
}
}
#pragma mark - Debug Functions

View file

@ -97,7 +97,17 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark - Event Functions
- (void)coreUpdateEvent:(NSNotification *)notif {
[self update];
@try {
[self update];
}
@catch (NSException *exception) {
if ([exception.name isEqualToString:@"LinphoneCoreException"]) {
LOGE(@"Core already destroyed");
return;
}
LOGE(@"Uncaught exception : %@", exception.description);
abort();
}
}
- (void) deviceOrientationDidChange:(NSNotification*) notif {

View file

@ -81,8 +81,18 @@
#pragma mark - Event Functions
- (void)coreUpdateEvent:(NSNotification *)notif {
// Invalid all pointers
[self loadData];
@try {
// Invalid all pointers
[self loadData];
}
@catch (NSException *exception) {
if ([exception.name isEqualToString:@"LinphoneCoreException"]) {
LOGE(@"Core already destroyed");
return;
}
LOGE(@"Uncaught exception : %@", exception.description);
abort();
}
}
#pragma mark - Property Functions