[Android] MediaBrowser: throw an exception if release is called more than one time
Thomas Guillem
git at videolan.org
Wed Jun 3 15:49:47 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jun 3 15:49:23 2015 +0200| [024a3ff55a56d22dbebb2f8d888f28106651c4bc] | committer: Thomas Guillem
MediaBrowser: throw an exception if release is called more than one time
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=024a3ff55a56d22dbebb2f8d888f28106651c4bc
---
libvlc/src/org/videolan/libvlc/util/MediaBrowser.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
index 21eaecf..cda93af 100644
--- a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
+++ b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
@@ -47,6 +47,7 @@ public class MediaBrowser {
private MediaList mBrowserMediaList;
private Media mMedia;
private EventListener mEventListener;
+ private boolean mAlive;
/**
* Listener called when medias are added or removed.
@@ -76,7 +77,7 @@ public class MediaBrowser {
mLibVlc = libvlc;
mLibVlc.retain();
mEventListener = listener;
-
+ mAlive = true;
}
private synchronized void reset() {
@@ -100,7 +101,10 @@ public class MediaBrowser {
*/
public synchronized void release() {
reset();
+ if (!mAlive)
+ throw new IllegalStateException("MediaBrowser released more than one time");
mLibVlc.release();
+ mAlive = false;
}
/**
More information about the Android
mailing list