Skip to content

Commit

Permalink
[expo-av] Fix mem-leak when unmounting Video component (#9379)
Browse files Browse the repository at this point in the history
* [expo-av] Fix mem-leak when unmounting Video view

* [expo-av] Clean-up unused observers

* [expo-av] Update changelog
  • Loading branch information
IjzerenHein committed Jul 24, 2020
1 parent e9aa9df commit 37f133d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/expo-av/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Prevent debugger break when removing observations. ([#9334](https://github.com/expo/expo/pull/9334) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix iOS stability issue due to player-item observers not cleaned up. ([#9350](https://github.com/expo/expo/pull/9350) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix duplicate full-screen will-dismiss event on iOS. ([#9366](https://github.com/expo/expo/pull/9366) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix mem-leak when unmounting Video component. ([#9379](https://github.com/expo/expo/pull/9379) by [@IjzerenHein](https://github.com/IjzerenHein))
- De-activate audio-session after unloading sound. ([#9365](https://github.com/expo/expo/pull/9365) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix resume audio when in background. ([#9363](https://github.com/expo/expo/pull/9363) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix instability issues when changing source and useNativeControls. ([#9381](https://github.com/expo/expo/pull/9381) by [@IjzerenHein](https://github.com/IjzerenHein))
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-av/ios/EXAV/EXAV.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ @interface EXAV ()
@property (nonatomic, assign) int soundDictionaryKeyCount;
@property (nonatomic, strong) NSMutableDictionary <NSNumber *, EXAVPlayerData *> *soundDictionary;
@property (nonatomic, assign) BOOL isBeingObserved;
@property (nonatomic, strong) NSMutableSet <NSObject<EXAVObject> *> *videoSet;
@property (nonatomic, strong) NSHashTable <NSObject<EXAVObject> *> *videoSet;

@property (nonatomic, strong) NSString *audioRecorderFilename;
@property (nonatomic, strong) NSDictionary *audioRecorderSettings;
Expand Down Expand Up @@ -79,7 +79,7 @@ - (instancetype)init
_soundDictionaryKeyCount = 0;
_soundDictionary = [NSMutableDictionary new];
_isBeingObserved = NO;
_videoSet = [NSMutableSet new];
_videoSet = [NSHashTable weakObjectsHashTable];

_audioRecorderFilename = nil;
_audioRecorderSettings = nil;
Expand Down
2 changes: 0 additions & 2 deletions packages/expo-av/ios/EXAV/Video/EXVideoView.m
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ - (void)removeFromSuperview
{
[self _removeData];
[self _removePlayer];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super removeFromSuperview];
}

Expand Down Expand Up @@ -743,7 +742,6 @@ - (void)handleMediaServicesReset:(void (^)(void))finishCallback
- (void)dealloc
{
[_exAV unregisterVideoForAudioLifecycle:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_data pauseImmediately];
[_exAV demoteAudioSessionIfPossible];
}
Expand Down

0 comments on commit 37f133d

Please sign in to comment.