Skip to content

Commit 0d1dc9b

Browse files
committed
Fix memory leak
1 parent 575f452 commit 0d1dc9b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Terminal Notifier/AppDelegate.m

+6-4
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,13 @@ - (void)userNotificationCenter:(NSUserNotificationCenter *)center
420420
^{
421421
__block BOOL notificationStillPresent;
422422
do {
423-
notificationStillPresent = NO;
424-
for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
425-
if ([nox.userInfo[@"uuid"] isEqualToString:[NSString stringWithFormat:@"%ld", self.hash] ]) notificationStillPresent = YES;
423+
@autoreleasepool {
424+
notificationStillPresent = NO;
425+
for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
426+
if ([nox.userInfo[@"uuid"] isEqualToString:[NSString stringWithFormat:@"%ld", self.hash] ]) notificationStillPresent = YES;
427+
}
428+
if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
426429
}
427-
if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
428430
} while (notificationStillPresent);
429431

430432
dispatch_async(dispatch_get_main_queue(), ^{

0 commit comments

Comments
 (0)