SDL_CreateTextureFromSurface Hanging

I am having an issue where the program seems to hang during a call to SDL_CreateTextureFromSurface.

I am using SDL with a C# project via interop so I am not sure if I can debug much further than the call to figure out what is happening.

The renderer and the surface are not null. The surface is rendered text generated using TTF_Render_Blended. The font is not null.

I’m not sure if this could be an issue with the font, or something else. The text that causes the stall is not consistent, and sometimes when I run the application the call to SDL_CreateTextureFromSurface does not hang at all.

When I generate the texture for a given string and font, the texture is cached to avoid generating too many textures. The surface is always freed right after creating the texture.

I have managed to compile SDL with debug symbols (I am on windows for additional clarity) and the stall happens in SDL_render_d3d.c in the D3D_CreateStagingTexture function when IDirect3DDevice9_CreateTexture is called. I do not know what this means. I’m not sure why it is hanging rather than returning an error.

Can be a memory corruption. If you wrote the SDL binding yourself, I’d ask to see it

My setup is built on top of this:

So most of the SDL stuff is untouched from that repo