macos: Fix race conditions
This commit fixes two issues:
- The event must be posted after calling
stop
, otherwise a race condition can occur and the app never stops -
isFinishedLaunching
andapplicationDidFinishLaunching
are not always synchronized, causing sometimes a deadlock on theg_cond_wait
never catching theg_cond_signal
Edited by Corentin Damman