From 0229a1605e6aabebd60401714edef69a07aa70ed Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 12 Apr 2017 23:41:59 +0200 Subject: [PATCH] properly unregister bookmark from conversations when deleting bookmark --- src/main/java/eu/siacs/conversations/entities/Bookmark.java | 1 + .../java/eu/siacs/conversations/entities/Conversation.java | 1 + .../eu/siacs/conversations/ui/ConferenceDetailsActivity.java | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index e6aeadf4a..f44ac6368 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -167,5 +167,6 @@ public class Bookmark extends Element implements ListItem { if (this.mJoinedConversation != null) { this.mJoinedConversation.deregisterWithBookmark(); } + this.mJoinedConversation = null; } } diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 146c8cc91..517221504 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -782,6 +782,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl if (this.bookmark != null) { this.bookmark.setConversation(null); } + this.bookmark = null; } public Bookmark getBookmark() { diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index 378e61c6e..da9ba754f 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -495,9 +495,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers protected void deleteBookmark() { Account account = mConversation.getAccount(); Bookmark bookmark = mConversation.getBookmark(); - bookmark.unregisterConversation(); + mConversation.deregisterWithBookmark(); account.getBookmarks().remove(bookmark); xmppConnectionService.pushBookmarks(account); + updateView(); } @Override