Browse Source

VLCMediaPlayer: Cache and use cached drawable

This fixes a crash when `setDrawable` was called twice. VLC was
trying to set the first call UIView as a drawable and not the second one.
Hence, causing a `EXC_BAD_ACCESS` since the first UIView was deallocated.

bt: https://pastebin.com/GrHie5i2
Signed-off-by: Carola Nitz <nitz.carola@googlemail.com>
(cherry picked from commit 78d096df33edac73fed7d93c2223a762bf19f895)
Soomin Lee 7 years ago
parent
commit
464d3f2309
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Sources/VLCMediaPlayer.m

+ 2 - 1
Sources/VLCMediaPlayer.m

@@ -340,7 +340,8 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
 - (void)setDrawable:(id)aDrawable
 {
     // Make sure that this instance has been associated with the drawing canvas.
-    libvlc_media_player_set_nsobject(_playerInstance, (__bridge void *)(aDrawable));
+    _drawable = aDrawable;
+    libvlc_media_player_set_nsobject(_playerInstance, (__bridge void *)(_drawable));
 }
 
 - (id)drawable