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_DestroyTexture called with invalid textures #129

Open
HexDecimal opened this issue Jun 3, 2023 · 0 comments
Open

SDL_DestroyTexture called with invalid textures #129

HexDecimal opened this issue Jun 3, 2023 · 0 comments
Labels

Comments

@HexDecimal
Copy link
Collaborator

Enabling SDL logging allowed me to track down this error.

texture_p = ffi.gc(lib.SDL_CreateTexture(self.p, format, access, width, height), lib.SDL_DestroyTexture)

This line creates a texture and takes ownership, but SDL will sometimes destroy the texture owned by this object, causing SDL_DestroyTexture to fail later and sometimes crash the program.

This issue can crash the samples if you restart the renderer during that program.

I'm noting this now so that I don't forget to fix this. I'll probably have the renderer track its textures with weak references and release ownership of its them when the renderer itself is deleted.

@HexDecimal HexDecimal added the bug label Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant