mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Fix mismatched delete
This commit is contained in:
parent
52f4c07648
commit
cdccf03228
1 changed files with 3 additions and 4 deletions
|
@ -1312,8 +1312,6 @@ namespace NifOsg
|
||||||
if (pixelData->mipmaps.empty())
|
if (pixelData->mipmaps.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
unsigned char* data = new unsigned char[pixelData->data.size()];
|
|
||||||
memcpy(data, &pixelData->data[0], pixelData->data.size());
|
|
||||||
unsigned int width = 0;
|
unsigned int width = 0;
|
||||||
unsigned int height = 0;
|
unsigned int height = 0;
|
||||||
|
|
||||||
|
@ -1326,7 +1324,6 @@ namespace NifOsg
|
||||||
if (mipSize + mip.dataOffset > pixelData->data.size())
|
if (mipSize + mip.dataOffset > pixelData->data.size())
|
||||||
{
|
{
|
||||||
std::cerr << "Internal texture's mipmap data out of bounds" << std::endl;
|
std::cerr << "Internal texture's mipmap data out of bounds" << std::endl;
|
||||||
delete data;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1342,10 +1339,12 @@ namespace NifOsg
|
||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Width and height must be non zero " << std::endl;
|
std::cerr << "Width and height must be non zero " << std::endl;
|
||||||
delete data;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char* data = new unsigned char[pixelData->data.size()];
|
||||||
|
memcpy(data, &pixelData->data[0], pixelData->data.size());
|
||||||
|
|
||||||
image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE);
|
image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE);
|
||||||
image->setMipmapLevels(mipmapVector);
|
image->setMipmapLevels(mipmapVector);
|
||||||
image->flipVertical();
|
image->flipVertical();
|
||||||
|
|
Loading…
Reference in a new issue