mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 856767: Finalize cursors on about:home. [r=mfinkle]
This commit is contained in:
parent
7e51e0b4bf
commit
f87c230ef4
@ -192,11 +192,12 @@ public class AboutHomeContent extends ScrollView
|
||||
* Reinflates and updates all components of this view.
|
||||
*/
|
||||
public void refresh() {
|
||||
mTopSites.onDestroy();
|
||||
|
||||
// We must remove the currently inflated view to allow for reinflation.
|
||||
removeAllViews();
|
||||
|
||||
inflate();
|
||||
mTopSites.refresh();
|
||||
|
||||
// Refresh all elements.
|
||||
update(AboutHomeContent.UpdateFlags.ALL);
|
||||
|
@ -141,9 +141,16 @@ public class TopSitesView extends GridView {
|
||||
|
||||
public void onDestroy() {
|
||||
if (mTopSitesAdapter != null) {
|
||||
Cursor cursor = mTopSitesAdapter.getCursor();
|
||||
if (cursor != null && !cursor.isClosed())
|
||||
cursor.close();
|
||||
setAdapter(null);
|
||||
final Cursor cursor = mTopSitesAdapter.getCursor();
|
||||
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cursor != null && !cursor.isClosed())
|
||||
cursor.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,12 +193,9 @@ public class TopSitesView extends GridView {
|
||||
|
||||
public void loadTopSites() {
|
||||
final ContentResolver resolver = mContext.getContentResolver();
|
||||
Cursor old = null;
|
||||
if (mTopSitesAdapter != null) {
|
||||
old = mTopSitesAdapter.getCursor();
|
||||
}
|
||||
|
||||
// Swap in the new cursor.
|
||||
final Cursor oldCursor = old;
|
||||
final Cursor oldCursor = (mTopSitesAdapter != null) ? mTopSitesAdapter.getCursor() : null;
|
||||
final Cursor newCursor = BrowserDB.getTopSites(resolver, mNumberOfTopSites);
|
||||
|
||||
post(new Runnable() {
|
||||
@ -340,13 +344,6 @@ public class TopSitesView extends GridView {
|
||||
mLoadCompleteCallback = callback;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
if (mTopSitesAdapter != null)
|
||||
mTopSitesAdapter.notifyDataSetChanged();
|
||||
|
||||
setAdapter(mTopSitesAdapter);
|
||||
}
|
||||
|
||||
private class TopSitesViewHolder {
|
||||
public TextView titleView = null;
|
||||
public ImageView thumbnailView = null;
|
||||
|
Loading…
Reference in New Issue
Block a user