Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

bug #3319036: fix one of the (severe) SMS bugs where the wrong conver…

…sation is opened.

- the code in ConversationList.onListItemClicked() was extracting the conversation data
from the ConversationListItem view passed in. However, ListItem views can be recycled
when rebound, so the view we got could now be reassigned to a different list position
and contain different data.

Intead of depend on ConversationListItem to store the conversation data, always load
the cursor at the position clicked, and get the conversation data from the cursor.

Merge from gingerbread



Change-Id: I276a2ffc48fb51a99c87584d7604f188aec1cb98
  • Loading branch information...
commit d5d22194f33c47f61ffef62678d308a1fa3d4a0e 1 parent a26034c
Tom Taylor authored cyanogen committed
Showing with 17 additions and 4 deletions.
  1. +17 −4 src/com/android/mms/ui/
21 src/com/android/mms/ui/
@@ -348,10 +348,23 @@ protected void onListItemClick(ListView l, View v, int position, long id) {
if (position == 0) {
- } else if (v instanceof ConversationListItem) {
- ConversationListItem headerView = (ConversationListItem) v;
- ConversationListItemData ch = headerView.getConversationHeader();
- openThread(ch.getThreadId());
+ } else {
+ // Note: don't read the thread id data from the ConversationListItem view passed in.
+ // It's unreliable to read the cached data stored in the view because the ListItem
+ // can be recycled, and the same view could be assigned to a different position
+ // if you click the list item fast enough. Instead, get the cursor at the position
+ // clicked and load the data from the cursor.
+ // (ConversationListAdapter extends CursorAdapter, so getItemAtPosition() should
+ // return the cursor object, which is moved to the position passed in)
+ Cursor cursor = (Cursor) getListView().getItemAtPosition(position);
+ Conversation conv = Conversation.from(this, cursor);
+ long tid = conv.getThreadId();
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "onListItemClick: pos=" + position + ", view=" + v + ", tid=" + tid);
+ }
+ openThread(tid);

0 comments on commit d5d2219

Please sign in to comment.
Something went wrong with that request. Please try again.