so here's my problem(s). I have a class DrawMgr in which function DrawCube I call, my other class' function draw in which I use SDL_Surface. My main problem is that when I start moving the mouse over the window I created after some time it gives a segmentation fault, which when I backtrace says it has something to do with freeing the surface. The other thing is when I call the function DrawCube in the DrawManager.cpp it doesn't draw the cube.
EDIT: The problem was that I handled the "Escape" key with
e.key.keysym.sym == SDLK_ESCAPE
e.type == SDL_KEYDOWN && e.key.keysym.sym...)
SDL_GetWindowSurface documentation says This surface will be freed when the window is destroyed. Do not free this surface.