[SDL] Writing C++ wrapper for 1.3, which file is FreeSurface in?
Jared Maddox
absinthdraco at gmail.com
Mon Nov 8 23:23:53 PST 2010
I'm writing a C++ wrapper for SDL 1.3. Specifically, I'm currently
writing smart pointers for the actual SDL types (I can decide whether
to write smart pointers for the wrappers later). Now, from my
perspective SDL_Surface has everything I need to easily create a
sharing- smart pointer with it (in the form of the refcount member),
but I need to know how to interact with it, and how other code
interacts with it. Thus, I have a few questions:
Is it safe for the smart pointer to automatically increment refcount
on every surface that's given to it? As far as I can tell it's
'expected', but there might be a gotcha in some code I haven't looked
at.
Is all of the actual SDL code that accesses refcount in the
SDL_Surface.c source file?
It is erroneous to free a locked surface, correct? (I realize that
SDL_FreeSurface() will unlock it, that doesn't mean it's proper
behavior )
As far as I can tell, simply calling SDL_FreeSurface() blindly on
destruction or reassignment should be perfectly fine (when used in
conjunction with arguments to control whether refcount gets
incremented in the first place), but I'm only checking the source
files where I think it makes sense for refcount to be accessed, so...
More information about the SDL
mailing list