[Android] Prevent VLCObject acccess once released

Geoffrey Métais git at videolan.org
Mon Nov 12 17:27:15 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov 12 15:17:25 2018 +0100| [b44cb3f72cda243f47b9d98301aaeba131fa9214] | committer: Geoffrey Métais

Prevent VLCObject acccess once released

> https://code.videolan.org/videolan/vlc-android/commit/b44cb3f72cda243f47b9d98301aaeba131fa9214
---

 libvlc/src/org/videolan/libvlc/VideoHelper.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/VideoHelper.java b/libvlc/src/org/videolan/libvlc/VideoHelper.java
index 6d8737d50..24278b71b 100644
--- a/libvlc/src/org/videolan/libvlc/VideoHelper.java
+++ b/libvlc/src/org/videolan/libvlc/VideoHelper.java
@@ -77,8 +77,8 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
     public void release() {
         if (mMediaPlayer.getVLCVout().areViewsAttached()) detachViews();
         mMediaPlayer = null;
-        mHandler.removeCallbacks(null);
         mVideoSurfaceFrame = null;
+        mHandler.removeCallbacks(null);
         mVideoSurface = null;
         mSubtitlesSurface = null;
         mVideoTexture = null;
@@ -99,7 +99,7 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
                 private final Runnable runnable = new Runnable() {
                     @Override
                     public void run() {
-                        if (mVideoSurfaceFrame != null) updateVideoSurfaces();
+                        if (mVideoSurfaceFrame != null && mOnLayoutChangeListener != null) updateVideoSurfaces();
                     }
                 };
                 @Override
@@ -117,11 +117,11 @@ class VideoHelper implements IVLCVout.OnNewVideoLayoutListener {
     }
 
     public void detachViews() {
-        mMediaPlayer.setVideoTrackEnabled(false);
         if (mOnLayoutChangeListener != null) {
             mVideoSurfaceFrame.removeOnLayoutChangeListener(mOnLayoutChangeListener);
             mOnLayoutChangeListener = null;
         }
+        mMediaPlayer.setVideoTrackEnabled(false);
         mMediaPlayer.getVLCVout().detachViews();
     }
 



More information about the Android mailing list