Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Dialog crashes with illegal instruction (MinGW) #11853

Open
evilnose opened this issue Jan 5, 2025 · 3 comments
Open

File Dialog crashes with illegal instruction (MinGW) #11853

evilnose opened this issue Jan 5, 2025 · 3 comments

Comments

@evilnose
Copy link

evilnose commented Jan 5, 2025

With SDL3 on MinGW, calling SDL_ShowSaveFileDialog and SDL_ShowOpenFileDialog will crash with illegal instruction. The file dialog still appears. This happens on the latest master branch commit, as well as on a random commit a few months ago.

image

Minimal sample:

inline void noop_callback(void *userdata, const char * const *filelist, int filter) {
}

inline void get_file_path(SDL_Window *window) {
  SDL_ShowSaveFileDialog(noop_callback,
                         nullptr /* userdata */,
                         nullptr /* window */,
                         nullptr /* filter */,
                         0 /* nfilters */,
                         "C:/foo.txt");
}

I've tried providing a window as argument, which oddly causes the file dialog to no longer appear, but the crash still occurs.

@slouken
Copy link
Collaborator

slouken commented Jan 5, 2025

What's the call stack?

@evilnose
Copy link
Author

evilnose commented Jan 5, 2025

@slouken I was linking against the DLL and couldn't obtain the call stack beyond my code using MinGW's gdb. I'm assuming that my CMAKE_BUILD_TYPE=Debug is propagating to SDL, so I'm not sure why this was the case.

So then I changed to static linking -- and the error disappeared! Everything seems to work fine now.
It seems the error might only occur when linking against a DLL on MinGW?

As a side note (I'm a noob on this), can I just get away with static linking SDL? I don't think executable size is a concern, since I think I'll need to distribute the DLL with my app even if I used dynamic linking. Would there be any other possible concerns?

@evilnose
Copy link
Author

evilnose commented Jan 5, 2025

Actually, I just rebuilt the project with dynamic linkage again and things are working fine now.
I've done a clean build before and the error was still there; but this time it's somehow disappeared.
I'll try some other arguments and see if I can repro this error again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants