mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
MediaPickerViewController: Add sanity checks to avoid crashes
- [MediaPickerViewController setupAVCapture] (in Riot) (MediaPickerViewController.m:1158) (https://github.com/matrix-org/riot-ios-rageshakes/issues/312) - [MediaPickerViewController tearDownAVCapture] (in Riot) (MediaPickerViewController.m:1198) (https://github.com/matrix-org/riot-ios-rageshakes/issues/314)
This commit is contained in:
parent
391712e2df
commit
c88d773922
1 changed files with 12 additions and 0 deletions
|
@ -1000,6 +1000,12 @@ static void *RecordingContext = &RecordingContext;
|
||||||
NSLog(@"[MediaPickerVC] Attemping to setup AVCapture when it is already started!");
|
NSLog(@"[MediaPickerVC] Attemping to setup AVCapture when it is already started!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!cameraQueue)
|
||||||
|
{
|
||||||
|
NSLog(@"[MediaPickerVC] Attemping to setup AVCapture when it is being destroyed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isCaptureSessionSetupInProgress = YES;
|
isCaptureSessionSetupInProgress = YES;
|
||||||
|
|
||||||
[self.cameraActivityIndicator startAnimating];
|
[self.cameraActivityIndicator startAnimating];
|
||||||
|
@ -1192,6 +1198,12 @@ static void *RecordingContext = &RecordingContext;
|
||||||
|
|
||||||
- (void)tearDownAVCapture
|
- (void)tearDownAVCapture
|
||||||
{
|
{
|
||||||
|
if (!cameraQueue)
|
||||||
|
{
|
||||||
|
NSLog(@"[MediaPickerVC] Attemping to tear down AVCapture when it is being destroyed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch_sync(cameraQueue, ^{
|
dispatch_sync(cameraQueue, ^{
|
||||||
frontCameraInput = nil;
|
frontCameraInput = nil;
|
||||||
backCameraInput = nil;
|
backCameraInput = nil;
|
||||||
|
|
Loading…
Reference in a new issue