From d466a0af07d30e6aeac0e40fc30095b650cb3496 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 28 Dec 2018 02:03:21 -0800 Subject: [PATCH] Only cleanup the stream on termination --- .../ViewControllers/StreamFrameViewController.m | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index ec8c8223..8118e07d 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -105,14 +105,17 @@ } - (void)willMoveToParentViewController:(UIViewController *)parent { - [_controllerSupport cleanup]; - [UIApplication sharedApplication].idleTimerDisabled = NO; - [_streamMan stopStream]; - if (_inactivityTimer != nil) { - [_inactivityTimer invalidate]; - _inactivityTimer = nil; + // Only cleanup when we're being destroyed + if (parent == nil) { + [_controllerSupport cleanup]; + [UIApplication sharedApplication].idleTimerDisabled = NO; + [_streamMan stopStream]; + if (_inactivityTimer != nil) { + [_inactivityTimer invalidate]; + _inactivityTimer = nil; + } + [[NSNotificationCenter defaultCenter] removeObserver:self]; } - [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void) returnToMainFrame {