From eab5ef197b0e5be0a596b3286eacf335c510a6e8 Mon Sep 17 00:00:00 2001 From: Radu Popovici Date: Wed, 23 Mar 2016 21:13:35 +0200 Subject: [PATCH] fix memory leak on iOS --- ios/RCTCamera.h | 4 ---- ios/RCTCamera.m | 8 ++++++++ ios/RCTCameraManager.h | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ios/RCTCamera.h b/ios/RCTCamera.h index 6d92743..3986880 100644 --- a/ios/RCTCamera.h +++ b/ios/RCTCamera.h @@ -6,10 +6,6 @@ @interface RCTCamera : UIView -@property (nonatomic) RCTCameraManager *manager; -@property (nonatomic) RCTBridge *bridge; -@property (nonatomic) RCTCameraFocusSquare *camFocus; - - (id)initWithManager:(RCTCameraManager*)manager bridge:(RCTBridge *)bridge; @end diff --git a/ios/RCTCamera.m b/ios/RCTCamera.m index 0d3b185..d0cf835 100644 --- a/ios/RCTCamera.m +++ b/ios/RCTCamera.m @@ -10,6 +10,14 @@ #import #import "CameraFocusSquare.h" +@interface RCTCamera () + +@property (nonatomic, weak) RCTCameraManager *manager; +@property (nonatomic, weak) RCTBridge *bridge; +@property (nonatomic, strong) RCTCameraFocusSquare *camFocus; + +@end + @implementation RCTCamera { BOOL _multipleTouches; diff --git a/ios/RCTCameraManager.h b/ios/RCTCameraManager.h index 51ac0c9..560db5c 100644 --- a/ios/RCTCameraManager.h +++ b/ios/RCTCameraManager.h @@ -48,17 +48,17 @@ typedef NS_ENUM(NSInteger, RCTCameraTorchMode) { @interface RCTCameraManager : RCTViewManager -@property (nonatomic) dispatch_queue_t sessionQueue; -@property (nonatomic) AVCaptureSession *session; -@property (nonatomic) AVCaptureDeviceInput *audioCaptureDeviceInput; -@property (nonatomic) AVCaptureDeviceInput *videoCaptureDeviceInput; -@property (nonatomic) AVCaptureStillImageOutput *stillImageOutput; -@property (nonatomic) AVCaptureMovieFileOutput *movieFileOutput; -@property (nonatomic) AVCaptureMetadataOutput *metadataOutput; -@property (nonatomic) id runtimeErrorHandlingObserver; -@property (nonatomic) NSInteger presetCamera; -@property (nonatomic) AVCaptureVideoPreviewLayer *previewLayer; -@property (nonatomic) NSInteger videoTarget; +@property (nonatomic, strong) dispatch_queue_t sessionQueue; +@property (nonatomic, strong) AVCaptureSession *session; +@property (nonatomic, strong) AVCaptureDeviceInput *audioCaptureDeviceInput; +@property (nonatomic, strong) AVCaptureDeviceInput *videoCaptureDeviceInput; +@property (nonatomic, strong) AVCaptureStillImageOutput *stillImageOutput; +@property (nonatomic, strong) AVCaptureMovieFileOutput *movieFileOutput; +@property (nonatomic, strong) AVCaptureMetadataOutput *metadataOutput; +@property (nonatomic, strong) id runtimeErrorHandlingObserver; +@property (nonatomic, assign) NSInteger presetCamera; +@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer; +@property (nonatomic, assign) NSInteger videoTarget; @property (nonatomic, strong) RCTPromiseResolveBlock videoResolve; @property (nonatomic, strong) RCTPromiseRejectBlock videoReject; @property (nonatomic, strong) RCTCamera *camera;