Browse Source

vpdc: protect autolayout against off-main thread action

(cherry picked from commit 591a34aa0f04b61b82b03837b75b2eeb05093814)
Felix Paul Kühne 9 years ago
parent
commit
e064bb3301
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Sources/VLCPlayerDisplayController.m

+ 5 - 0
Sources/VLCPlayerDisplayController.m

@@ -282,6 +282,11 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
 #if TARGET_OS_TV
     return;
 #else
+    if (![NSThread isMainThread]) {
+        [self performSelectorOnMainThread:@selector(_showHideMiniPlaybackView) withObject:nil waitUntilDone:NO];
+        return;
+    }
+
     VLCPlaybackController *playbackController = [VLCPlaybackController sharedInstance];
     UIView<VLCPlaybackControllerDelegate, VLCMiniPlaybackViewInterface> *miniPlaybackView = self.miniPlaybackView;
     const NSTimeInterval animationDuration = 0.25;