Commit f0af4fee authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCActivityManager: add main thread guard

(cherry picked from commit 5c209d95)
parent 1e2b105e
......@@ -35,6 +35,11 @@
- (void)activateIdleTimer
{
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(activateIdleTimer) withObject:nil waitUntilDone:NO];
return;
}
_idleCounter--;
if (_idleCounter < 1)
[UIApplication sharedApplication].idleTimerDisabled = NO;
......@@ -42,6 +47,11 @@
- (void)disableIdleTimer
{
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(disableIdleTimer) withObject:nil waitUntilDone:NO];
return;
}
_idleCounter++;
if ([UIApplication sharedApplication].idleTimerDisabled == NO)
[UIApplication sharedApplication].idleTimerDisabled = YES;
......@@ -49,6 +59,11 @@
- (void)networkActivityStarted
{
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(networkActivityStarted) withObject:nil waitUntilDone:NO];
return;
}
_networkActivityCounter++;
#if TARGET_OS_IOS
if ([UIApplication sharedApplication].networkActivityIndicatorVisible == NO)
......@@ -63,6 +78,11 @@
- (void)networkActivityStopped
{
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(networkActivityStopped) withObject:nil waitUntilDone:NO];
return;
}
_networkActivityCounter--;
#if TARGET_OS_IOS
if (_networkActivityCounter < 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment