Skip to content

file: apply SDL dialog result on main thread - #296

Merged
RobLoach merged 2 commits into
masterfrom
fix-sdl-dialog-thread
Jul 31, 2026
Merged

file: apply SDL dialog result on main thread#296
RobLoach merged 2 commits into
masterfrom
fix-sdl-dialog-thread

Conversation

@RobLoach

Copy link
Copy Markdown
Owner

SDL may invoke the dialog callback off the main thread, so stage the selected path and apply it via SDL_RunOnMainThread. Fixes #290

@RobLoach RobLoach closed this Jul 20, 2026
@RobLoach RobLoach reopened this Jul 20, 2026
@RobLoach

Copy link
Copy Markdown
Owner Author

Fix conflicts

@RobLoach
RobLoach marked this pull request as draft July 20, 2026 03:16
@RobLoach RobLoach self-assigned this Jul 21, 2026
@RobLoach
RobLoach force-pushed the fix-sdl-dialog-thread branch from c512a75 to 38892b4 Compare July 21, 2026 02:25
@RobLoach
RobLoach marked this pull request as ready for review July 21, 2026 02:25
Comment thread nuklear_console_file.h Outdated
NK_MEMCPY(data->file_path_buffer, filelist[0], (nk_size)(len + 1));
nk_console_trigger_event(file, NK_CONSOLE_EVENT_CHANGED);

nk_console_file_sdl_dialog_result* result = (nk_console_file_sdl_dialog_result*)SDL_malloc(sizeof(nk_console_file_sdl_dialog_result));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to handle this via SDL_LockMutex() or the like? or have the path variable from nk_console_file_sdl_dialog_result to be part of the nk_console file data to save having to re-implement another struct?

@RobLoach
RobLoach marked this pull request as draft July 29, 2026 18:46
@RobLoach
RobLoach marked this pull request as ready for review July 31, 2026 03:09
@RobLoach
RobLoach merged commit f47a6e1 into master Jul 31, 2026
6 checks passed
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

Successfully merging this pull request may close these issues.

file: SDL3 dialog callback may run off the main thread

1 participant