Commit f68a5779 authored by Geoffrey Métais's avatar Geoffrey Métais

Don't release MediaBrowser too soon

parent 61f871b2
......@@ -90,7 +90,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;
......@@ -107,8 +106,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();
......@@ -142,10 +139,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){
......@@ -216,7 +218,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
@Override
public void onBrowseEnd() {
mMediaBrowser.release();
mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
if (mReadyToDisplay)
display();
......@@ -515,7 +516,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());
......@@ -543,7 +543,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
mMediaBrowser.browse(mw.getUri());
} else {
mCurrentParsedPosition = -1;
mMediaBrowser.release();
}
}
directories .clear();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment