diff --git a/Extensions/Roster/XMPPRoster.m b/Extensions/Roster/XMPPRoster.m index 65c3d89990..4818fd10d5 100644 --- a/Extensions/Roster/XMPPRoster.m +++ b/Extensions/Roster/XMPPRoster.m @@ -41,10 +41,13 @@ - (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)prese #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -@implementation XMPPRoster +@implementation XMPPRoster{ + Boolean inEnumerating; +} - (id)init { + inEnumerating = NO; return [self initWithRosterStorage:nil dispatchQueue:NULL]; } @@ -768,12 +771,12 @@ - (void)handleFetchRosterQueryIQ:(XMPPIQ *)iq withInfo:(XMPPBasicTrackingInfo *) [xmppRosterStorage endRosterPopulationForXMPPStream:xmppStream]; // Process any premature presence elements we received. - + inEnumerating = YES; for (XMPPPresence *presence in earlyPresenceElements) { [self xmppStream:xmppStream didReceivePresence:presence]; } - + inEnumerating = NO; [earlyPresenceElements removeAllObjects]; } @@ -930,8 +933,8 @@ - (void)xmppStream:(XMPPStream *)sender didSendPresence:(XMPPPresence *)presence // So there's no need to refetch the roster. [xmppRosterStorage clearAllResourcesForXMPPStream:xmppStream]; - - [earlyPresenceElements removeAllObjects]; + if(inEnumerating == NO) + [earlyPresenceElements removeAllObjects]; } } @@ -952,8 +955,8 @@ - (void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error [self _setRequestedRoster:NO]; [self _setHasRoster:NO]; - - [earlyPresenceElements removeAllObjects]; + if(inEnumerating == NO) + [earlyPresenceElements removeAllObjects]; } #ifdef _XMPP_MUC_H