Fix a whole bunch of monkey bugs by making sure that the adapter
doesn't hold on to and tries to use a closed cursor.
diff --git a/src/com/android/music/TrackBrowserActivity.java b/src/com/android/music/TrackBrowserActivity.java
index f44c61b..3007601 100644
--- a/src/com/android/music/TrackBrowserActivity.java
+++ b/src/com/android/music/TrackBrowserActivity.java
@@ -233,13 +233,12 @@
             // we end up here in case we never registered the listeners
         }
         
-        // if we have an adapter and didn't send it off to another activity yet, we should
-        // close the cursor
+        // If we have an adapter and didn't send it off to another activity yet, we should
+        // close its cursor, which we do by assigning a null cursor to it. Doing this
+        // instead of closing the cursor directly keeps the framework from accessing
+        // the closed cursor later.
         if (!mAdapterSent && mAdapter != null) {
-            Cursor c = mAdapter.getCursor();
-            if (c != null) {
-                c.close();
-            }
+            mAdapter.changeCursor(null);
         }
         // Because we pass the adapter to the next activity, we need to make
         // sure it doesn't keep a reference to this activity. We can do this
@@ -1468,6 +1467,9 @@
         
         @Override
         public void changeCursor(Cursor cursor) {
+            if (mActivity.isFinishing()) {
+                return;
+            }
             if (cursor != mActivity.mTrackCursor) {
                 mActivity.mTrackCursor = cursor;
                 super.changeCursor(cursor);