Multithreaded SDL error in C++
- by wyatt
I'm building a program in C++, using SDL, and am occasionally receiving this error:
* glibc detected * ./assistant: double free or corruption (!prev)
It's difficult to replicate, so I can't find exactly what's causing it, but I just added a second thread to the program, and neither thread run on its own seems to cause the error.
The threads don't share any variables, though they both run the functions SDL_BlitSurface and SDL_Flip. Could running these concurrently throw up such an error, or am I barking up the wrong tree?
If this is the cause, should I simply throw a mutex around all SDL calls?
Thanks