Make sure MessageView series don't use mMailboxKey

Because "move" and "delete" are asynchronous operations, Message.mMailboxKey
can change any time.  We can't use stored values.

(Fortunately it was used at only one place, and this was actually unused.)

Change-Id: Idc1300a00122fe0e6372b0374cddc98aa54a47fc
This commit is contained in:
Makoto Onuki 2010-09-02 10:50:25 -07:00
parent bf2a53ef5e
commit b8efc2d048
2 changed files with 6 additions and 4 deletions

View File

@ -853,10 +853,9 @@ public class Controller {
*
* @param attachmentId the attachment to load
* @param messageId the owner message
* @param mailboxId the owner mailbox
* @param accountId the owner account
*/
public void loadAttachment(final long attachmentId, final long messageId, final long mailboxId,
public void loadAttachment(final long attachmentId, final long messageId,
final long accountId) {
Attachment attachInfo = Attachment.restoreAttachmentWithId(mProviderContext, attachmentId);

View File

@ -77,6 +77,10 @@ import java.util.regex.Pattern;
* Base class for {@link MessageViewFragment} and {@link MessageFileViewFragment}.
*
* See {@link MessageViewBase} for the class relation diagram.
*
* NOTE "Move to mailbox" and "delete message" are asynchronous operations, which means message'
* mailbox can change any time. Don't use {@link Message#mMailboxKey} of {@link #mMessage}
* directly. If you need, always load the latest value.
*/
public abstract class MessageViewFragmentBase extends Fragment implements View.OnClickListener {
private Context mContext;
@ -473,8 +477,7 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
ProgressBar bar = attachment.progressView;
bar.setVisibility(View.VISIBLE);
bar.setIndeterminate(true);
mController.loadAttachment(attachment.attachmentId, mMessageId, mMessage.mMailboxKey,
mAccountId);
mController.loadAttachment(attachment.attachmentId, mMessageId, mAccountId);
}
private void onCancelAttachment(AttachmentInfo attachment) {