Fix leak of UIComputerViews that poll forever

This commit is contained in:
Cameron Gutman
2018-12-27 19:50:29 -08:00
parent 3555d60a9b
commit dc00c1e3e7
+4
View File
@@ -183,8 +183,12 @@ static const int LABEL_DY = 20;
- (void) updateLoop { - (void) updateLoop {
[self updateContentsForHost:_host]; [self updateContentsForHost:_host];
// Stop updating when we detach from our parent view
if (self.superview != nil) {
[self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE]; [self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE];
} }
}
- (void) hostLongClicked:(UILongPressGestureRecognizer*)gesture { - (void) hostLongClicked:(UILongPressGestureRecognizer*)gesture {
if (gesture.state == UIGestureRecognizerStateBegan) { if (gesture.state == UIGestureRecognizerStateBegan) {