grimfang4 / sdl-gpu

A library for high-performance, modern 2D graphics with SDL written in C.
MIT License
1.2k stars 123 forks source link

Access Violation / Segmentation Fault when freeing "screen" GPU_Target alias #59

Closed AltairPL closed 7 years ago

AltairPL commented 7 years ago

As the title says, every time I try to free GPU_target created with GPU_CreateAliasTarget from "screen" GPU_Target application crashes. I'm a Ruby programmer, so my knowledge of C is limited, but I managed to make C application using "alias" test and debugging it revealed that it happens somewhere in FreeTarget function (wherever that is). It's possible I screwed up something when building DLL since I'm pretty new to all of this, but this is the only problem so far I had so far. Just in case it's relevant, DLL was built twice using mingw32-make and makefiles created with: 1) cmake-gui-3.8.0-rc1-win32-x86 with "MinGW Makefiles", 2) cmake built-in in CLion IDE, which apparently uses "CodeBlocks - MinGW Makefiles".

Don't know if that matters, but in both cases SDL_gpu was linked against SDL 2.0.5 . Oh, almost forgot... tried SDL2_gpu-0.10.0-mingw32.zip release and there was no such problem with it.

grimfang4 commented 7 years ago

I think I see where that would happen for aliases made of context targets (like the screen target). I'll see if I can put together a fix soon.

grimfang4 commented 7 years ago

This is fixed in bce7e296912d11bdbce6061f66bffa608bda9e75. Thanks!

AltairPL commented 7 years ago

Thank you!