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 @@ ...@@ -9,6 +9,7 @@
#include "position2d.h" #include "position2d.h"
#include "rect.h" #include "rect.h"
#include "SColor.h" #include "SColor.h"
#include "irrAllocator.h"
#include <string.h> #include <string.h>
namespace irr namespace irr
...@@ -49,7 +50,7 @@ public: ...@@ -49,7 +50,7 @@ public:
delete[] Data; delete[] Data;
if (DeleteMipMapsMemory) if (DeleteMipMapsMemory)
delete[] MipMapsData; Allocator.deallocate(MipMapsData);
} }
//! Returns the color format //! Returns the color format
...@@ -216,7 +217,7 @@ public: ...@@ -216,7 +217,7 @@ public:
{ {
if (DeleteMipMapsMemory) if (DeleteMipMapsMemory)
{ {
delete[] MipMapsData; Allocator.deallocate(MipMapsData);
DeleteMipMapsMemory = false; DeleteMipMapsMemory = false;
} }
...@@ -246,7 +247,7 @@ public: ...@@ -246,7 +247,7 @@ public:
dataSize += getDataSizeFromFormat(Format, width, height); dataSize += getDataSizeFromFormat(Format, width, height);
} while (width != 1 || height != 1); } while (width != 1 || height != 1);
MipMapsData = new u8[dataSize]; MipMapsData = Allocator.allocate(dataSize);
memcpy(MipMapsData, data, dataSize); memcpy(MipMapsData, data, dataSize);
DeleteMipMapsMemory = true; DeleteMipMapsMemory = true;
...@@ -494,6 +495,8 @@ protected: ...@@ -494,6 +495,8 @@ protected:
bool DeleteMemory; bool DeleteMemory;
bool DeleteMipMapsMemory; bool DeleteMipMapsMemory;
core::irrAllocator<u8> Allocator;
}; };
} // end namespace video } // 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