SEL::Surface segfault and potentials
Brought to you by:
knopp
Unlike in C, it is perfectly reasonable to expect a copy-constructor to work in C++ without any extra effort on part of the user.
Instead of keeping a m_autofree, just increment surface->refcount.
Also, SEL::Display should NEVER free its surface, that is handled by SDL_Quit. It might be nice.
Finally, there are no warnings about the circumstances under which it is safe to call SEL::createChildSurface - it is always valid for a surface that does not need locking, but if it called on a locked surface, it will be silently invalidated when the surface is unlocked again - there is no guarantee that the pixels pointer will stay the same if it is locked again.
Segfault with copy constructor case