From dc00c1e3e71150afca99bdbd4a445f5e41091fa3 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 27 Dec 2018 19:50:29 -0800 Subject: [PATCH] Fix leak of UIComputerViews that poll forever --- Limelight/UIComputerView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Limelight/UIComputerView.m b/Limelight/UIComputerView.m index be16e57..0e4036d 100644 --- a/Limelight/UIComputerView.m +++ b/Limelight/UIComputerView.m @@ -183,7 +183,11 @@ static const int LABEL_DY = 20; - (void) updateLoop { [self updateContentsForHost:_host]; - [self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE]; + + // Stop updating when we detach from our parent view + if (self.superview != nil) { + [self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE]; + } } - (void) hostLongClicked:(UILongPressGestureRecognizer*)gesture {