Commit 82b5708f authored by nadro's avatar nadro

- Fixed crash when app call IImage::setMipMapsData method and Irrlicht is compiled as DLL.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5275 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 2bc9c093
......@@ -9,6 +9,7 @@
#include "position2d.h"
#include "rect.h"
#include "SColor.h"
#include "irrAllocator.h"
#include <string.h>
namespace irr
......@@ -49,7 +50,7 @@ public:
delete[] Data;
if (DeleteMipMapsMemory)
delete[] MipMapsData;
Allocator.deallocate(MipMapsData);
}
//! Returns the color format
......@@ -216,7 +217,7 @@ public:
{
if (DeleteMipMapsMemory)
{
delete[] MipMapsData;
Allocator.deallocate(MipMapsData);
DeleteMipMapsMemory = false;
}
......@@ -246,7 +247,7 @@ public:
dataSize += getDataSizeFromFormat(Format, width, height);
} while (width != 1 || height != 1);
MipMapsData = new u8[dataSize];
MipMapsData = Allocator.allocate(dataSize);
memcpy(MipMapsData, data, dataSize);
DeleteMipMapsMemory = true;
......@@ -494,6 +495,8 @@ protected:
bool DeleteMemory;
bool DeleteMipMapsMemory;
core::irrAllocator<u8> Allocator;
};
} // end namespace video
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment