Make MemoryDealer's destructor protected instead of public.

MemoryDealer, like all other subclasses of RefBase,MUST NOT BE stack-allocated, a protected destructor prohibits stack-allocation while allowing the baseclass to properly invoke the subclass' destructor once the refcount drops to 0.
This commit is contained in:
Andreas Huber
2009-07-16 10:05:57 -07:00
parent d0c0e46a44
commit 262a583f2d

View File

@@ -218,8 +218,6 @@ public:
const sp<HeapInterface>& heap,
const sp<AllocatorInterface>& allocator);
virtual ~MemoryDealer();
virtual sp<IMemory> allocate(size_t size, uint32_t flags = 0);
virtual void deallocate(size_t offset);
virtual void dump(const char* what, uint32_t flags = 0) const;
@@ -228,6 +226,9 @@ public:
sp<IMemoryHeap> getMemoryHeap() const { return heap(); }
sp<AllocatorInterface> getAllocator() const { return allocator(); }
protected:
virtual ~MemoryDealer();
private:
const sp<HeapInterface>& heap() const;
const sp<AllocatorInterface>& allocator() const;