Fix conversation item and data source memory leaks.
This commit is contained in:
parent
b27198286d
commit
afbc132faa
2 changed files with 7 additions and 1 deletions
|
@ -49,7 +49,10 @@ class ConversationDataSource extends PositionalDataSource<MessageRecord> {
|
|||
}
|
||||
};
|
||||
|
||||
invalidator.observe(this::invalidate);
|
||||
invalidator.observe(() -> {
|
||||
invalidate();
|
||||
context.getContentResolver().unregisterContentObserver(contentObserver);
|
||||
});
|
||||
|
||||
context.getContentResolver().registerContentObserver(DatabaseContentProviders.Conversation.getUriForThread(threadId), true, contentObserver);
|
||||
}
|
||||
|
|
|
@ -377,6 +377,9 @@ public class ConversationItem extends LinearLayout implements BindableConversati
|
|||
if (recipient != null) {
|
||||
recipient.removeForeverObserver(this);
|
||||
}
|
||||
if (conversationRecipient != null) {
|
||||
conversationRecipient.removeForeverObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
public MessageRecord getMessageRecord() {
|
||||
|
|
Loading…
Add table
Reference in a new issue