From e628da0cccbba04c9d19b28b46e97107ab66beb7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 May 2012 23:20:01 +1000 Subject: TONY: Fix some inconsistent allocation/deallocations --- engines/tony/mpal/memory.cpp | 6 +++--- engines/tony/mpal/memory.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp index 604e61ed24..de6e918a38 100644 --- a/engines/tony/mpal/memory.cpp +++ b/engines/tony/mpal/memory.cpp @@ -127,9 +127,9 @@ uint32 MemoryManager::getSize(HGLOBAL handle) { /** * Erases a given item */ -void MemoryManager::erase(MemoryItem &item) { +void MemoryManager::erase(MemoryItem *item) { delete item; - _memoryBlocks.remove(&item); + _memoryBlocks.remove(item); } /** @@ -137,7 +137,7 @@ void MemoryManager::erase(MemoryItem &item) { */ void MemoryManager::erase(HGLOBAL handle) { MemoryItem &item = getItem(handle); - erase(item); + erase(&item); } } // end of namespace MPAL diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h index fde0d33b3e..ebf42b6207 100644 --- a/engines/tony/mpal/memory.h +++ b/engines/tony/mpal/memory.h @@ -36,14 +36,14 @@ typedef HANDLE HGLOBAL; class MemoryItem { protected: - void *_buffer; + byte *_buffer; uint32 _size; public: MemoryItem(uint32 size); virtual ~MemoryItem(); uint32 Size() { return _size; } - void *DataPointer() { return _buffer; } + void *DataPointer() { return (void *)_buffer; } bool IsValid() { return _buffer != NULL; } // Casting for access to data @@ -61,7 +61,7 @@ public: HGLOBAL alloc(uint32 size); MemoryItem &getItem(HGLOBAL handle); MemoryItem &operator[](HGLOBAL handle); - void erase(MemoryItem &item); + void erase(MemoryItem *item); void erase(HGLOBAL handle); uint32 getSize(HANDLE handle); -- cgit v1.2.3