Skip to content

Fix Windows file dialog calling the callback twice#15195

Open
Semphriss wants to merge 1 commit intolibsdl-org:mainfrom
Semphriss:dialog-fallback-windows
Open

Fix Windows file dialog calling the callback twice#15195
Semphriss wants to merge 1 commit intolibsdl-org:mainfrom
Semphriss:dialog-fallback-windows

Conversation

@Semphriss
Copy link
Contributor

Description

If the modern implementation of file dialogs on Windows fails, it will invoke the callback on error and report an error, then SDL would attempt invoking the dialog again using an older implementation, which would call the callback again.

This is not desired behavior, so it has been changed as follows:

  • If the modern dialog fails before showing (missing library/symbol), don't call the callback and try the older dialogs in case we're on an old platform.
  • If the dialog fails while or after showing, assume the error is a normal invocation error (such as an invalid path), call the callback with the error status and don't show the older dialogs to prevent showing two dialogs in succession to the user.

Existing Issue(s)

Fixes #15194

If the modern implementation of file dialogs on Windows fails, it will invoke the callback on error and report an error, then SDL would attempt invoking the dialog again using an older implementation, which would call the callback again.

This is not desired behavior, so it has been changed as follows:
- If the modern dialog fails before showing (missing library/symbol), don't call the callback and try the older dialogs in case we're on an old platform.
- If the dialog fails while or after showing, assume the error is a normal invocation error (such as an invalid path), call the callback and don't show the older dialogs to prevent showing two dialogs in succession to the user.
@slouken slouken added this to the 3.4.4 milestone Mar 12, 2026
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.

SDL_ShowOpenFileDialog's default_location handling of multiple levels of missing paths causes callback to be invoked twice on Windows (SDL 3.4.2)

2 participants