mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 22:23:52 +00:00
Ensure we don't deadlock if somehow a loading frame ends up under the active view
This commit is contained in:
@@ -383,6 +383,20 @@ static NSMutableSet* hostList;
|
|||||||
return topController;
|
return topController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) loadingFrameIsPresented {
|
||||||
|
UIViewController *nextController = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||||
|
|
||||||
|
while (nextController) {
|
||||||
|
if (nextController == _loadingFrame) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
nextController = nextController.presentedViewController;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)hostLongClicked:(TemporaryHost *)host view:(UIView *)view {
|
- (void)hostLongClicked:(TemporaryHost *)host view:(UIView *)view {
|
||||||
Log(LOG_D, @"Long clicked host: %@", host.name);
|
Log(LOG_D, @"Long clicked host: %@", host.name);
|
||||||
UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
|
UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
|
||||||
@@ -669,7 +683,7 @@ static NSMutableSet* hostList;
|
|||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
// If loading frame is already active, just complete it now otherwise
|
// If loading frame is already active, just complete it now otherwise
|
||||||
// we may not get a completion callback.
|
// we may not get a completion callback.
|
||||||
if ([self activeViewController] == self->_loadingFrame) {
|
if ([self loadingFrameIsPresented]) {
|
||||||
dispatch_semaphore_signal(self->_loadingFrameSemaphore);
|
dispatch_semaphore_signal(self->_loadingFrameSemaphore);
|
||||||
if (completion) {
|
if (completion) {
|
||||||
completion();
|
completion();
|
||||||
@@ -695,7 +709,7 @@ static NSMutableSet* hostList;
|
|||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
// If loading frame is already dismissed, just complete it now otherwise
|
// If loading frame is already dismissed, just complete it now otherwise
|
||||||
// we may not get a completion callback.
|
// we may not get a completion callback.
|
||||||
if ([self activeViewController] != self->_loadingFrame) {
|
if (![self loadingFrameIsPresented]) {
|
||||||
[self enableNavigation];
|
[self enableNavigation];
|
||||||
dispatch_semaphore_signal(self->_loadingFrameSemaphore);
|
dispatch_semaphore_signal(self->_loadingFrameSemaphore);
|
||||||
if (completion) {
|
if (completion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user