Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3708db1 authored by blong's avatar blong Committed by Gerrit - the friendly Code Review server
Browse files

Fix StaleDataException when add group in message

- Notify the dataset invalid instead of managed it by activity to
  avoid requery a closed cursor.

Change-Id: I4a5e30fe6df679f0626b9a0c9161221ebc49733b
CRs-Fixed: 1077298
parent b9ab67d4
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ public class GroupsFragment extends ExpandableListFragment implements OnGroupCli
        if (mAdapter.getCursor() != null) {
            mAdapter.getCursor().close();
        }

        mAdapter.notifyDataSetInvalidated();
        if(allContactsInGroups!=null)
            allContactsInGroups.close();

@@ -790,8 +790,6 @@ public class GroupsFragment extends ExpandableListFragment implements OnGroupCli
        protected Cursor getChildrenCursor(Cursor groupCursor) {
            long groupId = groupCursor.getLong(GROUP_ID);
            Cursor c = getContactsDetailCursor(groupId);
            if (c != null)
                getActivity().startManagingCursor(c);
            return c;
        }

@@ -811,7 +809,7 @@ public class GroupsFragment extends ExpandableListFragment implements OnGroupCli
        private void fillAllContactsCursorMap() {
            mAllContactsCurosrMap.clear();
            Cursor cursor = null;
            if (mGroupsCursor == null)
            if (mGroupsCursor == null || mGroupsCursor.isClosed())
                return;
            for (int groupPosition = 0; groupPosition < mGroupsCursor.getCount(); groupPosition++) {
                mGroupsCursor.moveToPosition(groupPosition);