[Android] [PATCH] Don't release MediaBrowser too soon
Geoffrey Métais
geoffrey.metais at gmail.com
Sat May 30 16:17:41 CEST 2015
---
.../org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index f2b6f1b..fb0bd5d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -91,7 +91,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
protected MediaWrapper mCurrentMedia;
protected int mSavedPosition = -1, mFavorites = 0;
public boolean mRoot;
- protected LibVLC mLibVLC;
private SparseArray<ArrayList<MediaWrapper>> mMediaLists = new SparseArray<ArrayList<MediaWrapper>>();
private ArrayList<MediaWrapper> mediaList;
@@ -108,8 +107,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
public void onCreate(Bundle bundle){
super.onCreate(bundle);
- mLibVLC = VLCInstance.get();
- mMediaBrowser = new MediaBrowser(mLibVLC, this);
if (bundle == null)
bundle = getArguments();
@@ -143,10 +140,15 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
return v;
}
+ @Override
+ public void onStart() {
+ super.onStart();
+ mMediaBrowser = new MediaBrowser(VLCInstance.get(), this);
+ }
+
public void onStop(){
super.onStop();
- if (mMediaBrowser != null)
- mMediaBrowser.release();
+ mMediaBrowser.release();
}
public void onSaveInstanceState(Bundle outState){
@@ -217,7 +219,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
@Override
public void onBrowseEnd() {
- mMediaBrowser.release();
mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
if (mReadyToDisplay)
display();
@@ -516,7 +517,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
public void onBrowseEnd() {
if (mAdapter.isEmpty()) {
mCurrentParsedPosition = -1;
- mMediaBrowser.release();
return;
}
String holderText = getDescription(directories.size(), files.size());
@@ -544,7 +544,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
mMediaBrowser.browse(mw.getUri());
} else {
mCurrentParsedPosition = -1;
- mMediaBrowser.release();
}
}
directories .clear();
--
2.1.4
More information about the Android
mailing list