macOS: fix crash on document open with sdl2-compat - #2500
Merged
flyinghead merged 1 commit intoSep 20, 2026
Merged
Conversation
sdl2-compat (what Homebrew installs as sdl2) doesn't convert the file name of an SDL_DROPFILE event pushed by the application, then crashes in strdup(NULL) when converting the event back during window creation. Carry the path in a registered user event instead.
richstokes
added a commit
to richstokes/dreamcast-homebrew
that referenced
this pull request
Sep 21, 2026
flyinghead/flycast#2500 is merged, so the bundled-SDL detour and its Objective-C build patch hunk are no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2492. When Flycast is built against Homebrew's
sdl2, which is now sdl2-compat on top of SDL3, launching with a game on the command line segfaults during window creation:AppKit also delivers the command-line game through
application:openFile:, which pushes anSDL_DROPFILEevent. sdl2-compat'sEvent2to3()has no case for drop events, so the SDL2drop.filepointer doesn't end up in SDL3'sdrop.data. When the queued event is later converted back,Event3to2()callsSDL_strdup(event3->drop.data)with NULL. Official builds bundle real SDL2, so they aren't affected.This keeps the design from #2492 (the document waits in SDL's event queue until the main loop is running, without setting
commandLineStart) but carries the path in an event type fromSDL_RegisterEvents(). User events keep the same layout in both SDL versions, sodata1survives the round trip. The queueing moves intosdl_queue_open_file()incore/sdl/sdl.cppnext to the handler that frees the string.Tested on Apple Silicon, macOS 27, native CMake build of this branch:
open -a Flycast.app game.elf