File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -836,13 +836,31 @@ -(void)itemStalledPlaying:(NSNotification *) notification {
836
836
837
837
- (void )onMemoryWarning
838
838
{
839
- [[self soundCache ] removeAllObjects ];
840
- [self setSoundCache: nil ];
839
+ /* https://issues.apache.org/jira/browse/CB-11513 */
840
+ NSMutableArray * keysToRemove = [[NSMutableArray alloc ] init ];
841
+
842
+ for (id key in [self soundCache ]) {
843
+ CDVAudioFile* audioFile = [[self soundCache ] objectForKey: key];
844
+ if (audioFile != nil ) {
845
+ if (audioFile.player != nil && ![audioFile.player isPlaying ]) {
846
+ [keysToRemove addObject: key];
847
+ }
848
+ if (audioFile.recorder != nil && ![audioFile.recorder isRecording ]) {
849
+ [keysToRemove addObject: key];
850
+ }
851
+ }
852
+ }
853
+
854
+ [[self soundCache ] removeObjectsForKeys: keysToRemove];
855
+
856
+ // [[self soundCache] removeAllObjects];
857
+ // [self setSoundCache:nil];
841
858
[self setAvSession: nil ];
842
859
843
860
[super onMemoryWarning ];
844
861
}
845
862
863
+
846
864
- (void )dealloc
847
865
{
848
866
[[self soundCache ] removeAllObjects ];
You can’t perform that action at this time.
0 commit comments