From 31f11070e37636e9c47d74ad080c4786b14ff1b7 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 10 Sep 2014 17:59:57 +0200 Subject: IT'S CHRISTMAS ALREADY! --- .../siacs/conversations/services/XmppConnectionService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/eu/siacs/conversations/services') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index f272486cc..c019682e3 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(); + } } } -- cgit v1.2.3