From a9c9a4baf24700e8817d47d8ea8da1742caea0b5 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Sun, 12 Jun 2011 18:05:53 -0700 Subject: fix RefBase so it retains binary-compatibility with gingerbread (DO NOT MERGE) Bug: 4595257 Change-Id: I1db83149107d7dab1f0b7e73c684e0ff82e17e62 --- include/utils/RefBase.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h index e88cb29..4a41830 100644 --- a/include/utils/RefBase.h +++ b/include/utils/RefBase.h @@ -117,16 +117,22 @@ public: typedef RefBase basetype; -protected: - RefBase(); - virtual ~RefBase(); + // used to override the RefBase destruction. + class Destroyer { + friend class RefBase; + public: + virtual ~Destroyer(); + private: + virtual void destroy(RefBase const* base) = 0; + }; - // called when the last reference goes away. this is responsible for - // calling the destructor. The default implementation just does - // "delete this;". // Make sure to never acquire a strong reference from this function. The // same restrictions than for destructors apply. - virtual void destroy() const; + void setDestroyer(Destroyer* destroyer); + +protected: + RefBase(); + virtual ~RefBase(); //! Flags for extendObjectLifetime() enum { -- cgit v1.1