Skip to content

macos: Fix gst_macos_main() terminating whole process before returning a value

Piotr Brzeziński requested to merge thewildtree/gstreamer:macos-main-fix into main

Fixes #3251 (closed)

Removes the usage of [NSApp terminate] to avoid killing the process and thus never actually returning a value.
The new way is just to use [NSApp stop] and send an event, since stop only happens after an event is processed.
Unlike terminate, stop will only halt the event loop, not the whole process.

This uses an NSApplicationDelegate to listen for NSApp finishing the launch process, and then signals the 'main' thread
to proceed. That makes sure to never call [NSApp stop] before NSApp is actually running, which could happen if the
provided 'main' function finished quickly enough.

Merge request reports