Fixed scoped allocator -- this should have never worked

This commit is contained in:
Pavel Krajcevski 2015-12-20 16:24:17 -05:00
parent 8a1906e7b7
commit 6f2ee27a0e
2 changed files with 2 additions and 8 deletions

View File

@ -63,12 +63,7 @@ namespace FasTC {
T *m_Ptr; T *m_Ptr;
ScopedAllocator() : m_Ptr(NULL) { } ScopedAllocator() : m_Ptr(NULL) { }
public: public:
static ScopedAllocator<T> Create(uint32 nBytes) { ScopedAllocator<T>(uint32 nBytes) : m_Ptr(new T[nBytes]) { }
ScopedAllocator<T> actr;
actr.m_Ptr = new T[nBytes];
return actr;
}
~ScopedAllocator() { ~ScopedAllocator() {
if(m_Ptr) { if(m_Ptr) {
delete [] m_Ptr; delete [] m_Ptr;

View File

@ -205,8 +205,7 @@ bool ImageLoaderKTX::ReadData() {
const uint8 *imgData = rdr.GetData() + bytesOfKeyValueData; const uint8 *imgData = rdr.GetData() + bytesOfKeyValueData;
while(rdr.GetData() < imgData) { while(rdr.GetData() < imgData) {
LOAD(keyAndValueByteSize); LOAD(keyAndValueByteSize);
FasTC::ScopedAllocator<uint8> keyValueData = FasTC::ScopedAllocator<uint8> keyValueData(keyAndValueByteSize);
FasTC::ScopedAllocator<uint8>::Create(keyAndValueByteSize);
if(!keyValueData) { if(!keyValueData) {
fprintf(stderr, "KTX loader - out of memory.\n"); fprintf(stderr, "KTX loader - out of memory.\n");
return false; return false;