From f0adf848ffffeca86f4c0210ea237883d9e5e8d5 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 16 Jul 2009 10:05:57 -0700 Subject: 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. --- include/binder/MemoryDealer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/binder') diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h index 6628f75..03ac70a 100644 --- a/include/binder/MemoryDealer.h +++ b/include/binder/MemoryDealer.h @@ -218,8 +218,6 @@ public: const sp& heap, const sp& allocator); - virtual ~MemoryDealer(); - virtual sp 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 getMemoryHeap() const { return heap(); } sp getAllocator() const { return allocator(); } +protected: + virtual ~MemoryDealer(); + private: const sp& heap() const; const sp& allocator() const; -- cgit v1.1