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

SDL_ShowOpenFileDialog memory leak on Linux #12036

Closed
SnootierMoon opened this issue Jan 21, 2025 · 1 comment · Fixed by #12037
Closed

SDL_ShowOpenFileDialog memory leak on Linux #12036

SnootierMoon opened this issue Jan 21, 2025 · 1 comment · Fixed by #12037
Assignees
Milestone

Comments

@SnootierMoon
Copy link

SnootierMoon commented Jan 21, 2025

The behavior I am noticing is on Wayland using SDL 3.1.10. When I call SDL_ShowOpenFileDialog and then cancel the dialog, I notice a memory leak. I found (using the power of Zig's awesome debug allocator) that the following allocations are not freed:

here and here.

While I don't know the codebase very well, I did some printf debugging and what seems to be happening is that the callback is going into this if statement when the user cancels the dialog, which has the line goto handled, which apparently skips the cleanup for those two allocations.

This seems like the cause of the bug, but I am hesitant to fix it myself because I am not very familiar with the codebase. I am not sure what the intent of goto handled is as opposed to goto cleanup in the other code paths.

@slouken slouken added this to the 3.2.0 milestone Jan 21, 2025
@slouken slouken self-assigned this Jan 21, 2025
slouken added a commit to slouken/SDL that referenced this issue Jan 21, 2025
@slouken
Copy link
Collaborator

slouken commented Jan 21, 2025

Can you try the patch in #12037?

I found a few bugs in there, hopefully this works?

slouken added a commit to slouken/SDL that referenced this issue Jan 21, 2025
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 a pull request may close this issue.

2 participants