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

Problem with callbacks #8

Closed
M-HT opened this issue Mar 17, 2019 · 4 comments
Closed

Problem with callbacks #8

M-HT opened this issue Mar 17, 2019 · 4 comments

Comments

@M-HT
Copy link
Contributor

M-HT commented Mar 17, 2019

Here's an example of problematic scenario with callbacks:

  • SDL_OpenAudio is called with callback which uses AddCallback to add a new callback
  • inside the callback function the code calls qsort which uses AddSharedCallback to add a new shared callback and then uses FreeCallback to remove the shared callback
  • since qsort callback is shared, it uses the same emu as callback from SDL_OpenAudio, so removing the shared callback also removes the callback from SDL_OpenAudio
  • further calls to SDL_OpenAudio callback print the text Warning, Callback not found?! instead of calling the callback
@ptitSeb
Copy link
Owner

ptitSeb commented Mar 17, 2019

The FreeCallback on a Shared callback should not free the emu. I'll check that, thanks!

EDIT Oh, I see, the Callback itself is deleted, not the emu!

@ptitSeb ptitSeb reopened this Mar 17, 2019
@ptitSeb
Copy link
Owner

ptitSeb commented Mar 17, 2019

Commit 0398803 should have fixed it.

@M-HT
Copy link
Contributor Author

M-HT commented Mar 17, 2019

I tested it and the problem is fixed (at least in described scenario).

@M-HT M-HT closed this as completed Mar 17, 2019
@ptitSeb
Copy link
Owner

ptitSeb commented Mar 17, 2019

Nice, thanks for testing.

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