summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java4
-rw-r--r--src/com/android/browser/util/ThreadedCursorAdapter.java6
2 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index cb53107..3a0c65a 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -411,7 +411,9 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
LoaderManager lm = getLoaderManager();
lm.destroyLoader(LOADER_ACCOUNTS);
for (int id : mBookmarkAdapters.keySet()) {
- lm.destroyLoader(id);
+ synchronized (mBookmarkAdapters.get(id).mCursorLock) {
+ lm.destroyLoader(id);
+ }
}
mBookmarkAdapters.clear();
}
diff --git a/src/com/android/browser/util/ThreadedCursorAdapter.java b/src/com/android/browser/util/ThreadedCursorAdapter.java
index 72a07ea..d350999 100644
--- a/src/com/android/browser/util/ThreadedCursorAdapter.java
+++ b/src/com/android/browser/util/ThreadedCursorAdapter.java
@@ -39,7 +39,7 @@ public abstract class ThreadedCursorAdapter<T> extends BaseAdapter {
private static final boolean DEBUG = false;
private Context mContext;
- private Object mCursorLock = new Object();
+ public Object mCursorLock = new Object();
private CursorAdapter mCursorAdapter;
private T mLoadingObject;
private Handler mLoadHandler;
@@ -150,6 +150,10 @@ public abstract class ThreadedCursorAdapter<T> extends BaseAdapter {
return;
}
synchronized (mCursorLock) {
+ if ((mCursorAdapter == null) || (mCursorAdapter.getCursor() == null)
+ || mCursorAdapter.getCursor().isClosed()) {
+ return;
+ }
Cursor c = (Cursor) mCursorAdapter.getItem(position);
if (c == null || c.isClosed()) {
return;