aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/services')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index f272486c..c019682e 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -109,6 +109,7 @@ public class XmppConnectionService extends Service {
private OnAccountUpdate mOnAccountUpdate = null;
private int accountChangedListenerCount = 0;
private OnRosterUpdate mOnRosterUpdate = null;
+ private int rosterChangedListenerCount = 0;
public OnContactStatusChanged onContactStatusChanged = new OnContactStatusChanged() {
@Override
@@ -997,12 +998,16 @@ public class XmppConnectionService extends Service {
switchToForeground();
}
this.mOnRosterUpdate = listener;
+ this.rosterChangedListenerCount++;
}
public void removeOnRosterUpdateListener() {
- this.mOnRosterUpdate = null;
- if (checkListeners()) {
- switchToBackground();
+ this.rosterChangedListenerCount--;
+ if (this.rosterChangedListenerCount == 0) {
+ this.mOnRosterUpdate = null;
+ if (checkListeners()) {
+ switchToBackground();
+ }
}
}