Weakify self on presence notifications observers

This commit is contained in:
aringenbach
2022-04-05 15:21:53 +02:00
parent 38363b1832
commit 2ab98cfe07
3 changed files with 7 additions and 1 deletions
@@ -142,8 +142,10 @@ NSString *const kMXKContactCellContactIdKey = @"kMXKContactCellContactIdKey";
if (! self.hideMatrixPresence)
{
// Observe contact presence change
MXWeakify(self);
mxPresenceObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKContactManagerMatrixUserPresenceChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
MXStrongifyAndReturnIfNil(self);
// get the matrix identifiers
NSArray* matrixIdentifiers = self->contact.matrixIdentifiers;
if (matrixIdentifiers.count > 0)