From 7db488cdfbca4baaa75f4e8c44890531601c3e21 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Wed, 24 Sep 2014 13:45:49 +0100 Subject: [PATCH] Fixed: CPImageView no longer leaks due to image load notification. Previously, CPImageView would sometimes attach a notification to CPImageDidLoadNotification when the image was set, but would never remove this notification. The view could then leak memory as the notification center would be keeping a reference even if the view was no longer being used. This commit fixes that issue by removing the observation once the image has loaded. Fixes #2198. --- AppKit/CPImageView.j | 1 + 1 file changed, 1 insertion(+) diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j index 5f92e0fe9..1c4ef8dbc 100644 --- a/AppKit/CPImageView.j +++ b/AppKit/CPImageView.j @@ -178,6 +178,7 @@ var CPImageViewEmptyPlaceholderImage = nil; - (void)imageDidLoad:(CPNotification)aNotification { + [[CPNotificationCenter defaultCenter] removeObserver:self name:CPImageDidLoadNotification object:[self objectValue]]; [self hideOrDisplayContents]; [self setNeedsLayout];