[Android] Avoid modifying audioplayer while closing activity

Geoffrey Métais git at videolan.org
Mon Jan 28 15:01:24 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jan 28 14:52:51 2019 +0100| [25a2065192b7703e08f3b2a8b070bc62a76951cb] | committer: Geoffrey Métais

Avoid modifying audioplayer while closing activity

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

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 3053dc600..93d52cef4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -242,6 +242,7 @@ public class AudioPlayerContainerActivity extends BaseActivity {
      * Show the audio player.
      */
     public void showAudioPlayer() {
+        if (isFinishing()) return;
         mActivityHandler.sendEmptyMessageDelayed(ACTION_SHOW_PLAYER, 100L);
     }
 
@@ -282,6 +283,7 @@ public class AudioPlayerContainerActivity extends BaseActivity {
      * Hide the audio player.
      */
     public void hideAudioPlayer() {
+        if (isFinishing()) return;
         mActivityHandler.sendEmptyMessage(ACTION_HIDE_PLAYER);
     }
 
@@ -418,9 +420,8 @@ public class AudioPlayerContainerActivity extends BaseActivity {
         @Override
         public void handleMessage(Message msg) {
             super.handleMessage(msg);
-            AudioPlayerContainerActivity owner = getOwner();
-            if (owner == null)
-                return;
+            final AudioPlayerContainerActivity owner = getOwner();
+            if (owner == null) return;
             switch (msg.what){
                 case ACTION_DISPLAY_PROGRESSBAR:
                     removeMessages(ACTION_DISPLAY_PROGRESSBAR);



More information about the Android mailing list