diff --git a/frontend/platform/platform_apple.c b/frontend/platform/platform_apple.c index b3f1676eb2..1bd337c510 100644 --- a/frontend/platform/platform_apple.c +++ b/frontend/platform/platform_apple.c @@ -106,24 +106,24 @@ static void do_iteration(void) void apple_start_iteration(void) { - if (iterate_observer == NULL) - { - iterate_observer = + if (iterate_observer) + return; + + iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting, - true, 0, (CFRunLoopObserverCallBack)do_iteration, 0); - CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, - kCFRunLoopCommonModes); - } + true, 0, (CFRunLoopObserverCallBack)do_iteration, 0); + CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, + kCFRunLoopCommonModes); } void apple_stop_iteration(void) { - if (iterate_observer != NULL) - { - CFRunLoopObserverInvalidate(iterate_observer); - CFRelease(iterate_observer); - iterate_observer = NULL; - } + if (!iterate_observer) + return; + + CFRunLoopObserverInvalidate(iterate_observer); + CFRelease(iterate_observer); + iterate_observer = NULL; } static void frontend_apple_get_environment_settings(int *argc, char *argv[],