[c++/sdl_font] memleaking vector

Started by
10 comments, last by theSecondt 17 years, 6 months ago
Quote:Original post by Agony
You'd end up with a problem anyway, even if you used a smart pointer that does work with containers (such as boost::shared_ptr).

Actually Boost's smart pointers are sufficiently smart that they could be used here. All you'd have to do is pass SDL_FreeSurface when constructing the pointer (boost::shared_ptr< SDL_Surface > shared_ptr(TTF_RenderText_Solid(FontText, setFontVar.c_str(), local_fg), SDL_FreeSurface);).

theSecondt: What exactly is going wrong and how are you diagnosing it? Going from an array to a vector should be trivial.

Σnigma
Advertisement
sigh.
well, i can give you the whole code, since this were only snippets from different parts of different classes.

enigma: i know for sure that the problem occurs when i try to draw values from vars on screen, because they are in a loop.
static text(?) works fine(if i haven't done something horrific before in the code).

i have _tried_ to use gdb, but it fails at the 6th frame.. it seems there's a problem with the SDL_image library(or so i assume) i am using.

This topic is closed to new replies.

Advertisement