Code: Select all
if( m_pBuffer && m_bAutoDelete )
{
delete[] m_pBuffer;
m_pBuffer = NULL;
}
All those non-verification make sure memory leaks as soon as an Image is used twice.
While I'm here, I'd really like to have an access to the m_bAutoDelete private attribute in Image, when loading dynamic image, as in here :
method prototype :
Code: Select all
Image& loadDynamicImage( uchar* pData,
ushort uWidth,
ushort uHeight,
PixelFormat eFormat,
bool autoDelete = false);
Code: Select all
//-----------------------------------------------------------------------------
Image& Image::loadDynamicImage( uchar* pData, ushort uWidth,
ushort uHeight, PixelFormat eFormat, bool autoDelete)
{
OgreGuard( "Image::loadDynamicImage" );
m_uWidth = uWidth;
m_uHeight = uHeight;
m_eFormat = eFormat;
m_ucPixelSize = PixelUtil::getNumElemBytes( m_eFormat );
m_uSize = m_uWidth * m_uHeight * m_ucPixelSize;
m_pBuffer = pData;
m_bAutoDelete = autoDelete;
OgreUnguardRet( *this );
}