Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
julienXX committed May 12, 2017
1 parent 575f452 commit 0d1dc9b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Terminal Notifier/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,13 @@ - (void)userNotificationCenter:(NSUserNotificationCenter *)center
^{
__block BOOL notificationStillPresent;
do {
notificationStillPresent = NO;
for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
if ([nox.userInfo[@"uuid"] isEqualToString:[NSString stringWithFormat:@"%ld", self.hash] ]) notificationStillPresent = YES;
@autoreleasepool {
notificationStillPresent = NO;
for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
if ([nox.userInfo[@"uuid"] isEqualToString:[NSString stringWithFormat:@"%ld", self.hash] ]) notificationStillPresent = YES;
}
if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
}
if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
} while (notificationStillPresent);

dispatch_async(dispatch_get_main_queue(), ^{
Expand Down

0 comments on commit 0d1dc9b

Please sign in to comment.