summaryrefslogtreecommitdiff
path: root/include/utils/RefBase.h
diff options
context:
space:
mode:
author Simon Wilson <simonwilson@google.com> 2011-05-24 17:07:39 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-05-24 17:07:39 -0700
commitc9cd2387b6938a6fbefc731d2177902266f2a130 (patch)
treeb6b7f4ca61ee3c9d29e1c2d1ded10993e4cca4a0 /include/utils/RefBase.h
parent34f5991ebe8b203f1720caf95889c15dd131d86e (diff)
parent6f96080f333c70104424f42ac263c4c9c7a9dd2a (diff)
Merge changes I37f0f315,I8cbf6044,Ibb598931,I5262bf11 into gingerbread
* changes: Fix a race that could cause GL commands to be executed from the wrong thread. RefBase subclasses can now decide how they want to be destroyed. Fix a race in SurfaceFlinger that could cause layers to be leaked forever. Fix a race-condtion in SurfaceFlinger that could lead to a crash.
Diffstat (limited to 'include/utils/RefBase.h')
-rw-r--r--include/utils/RefBase.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index c24c0dbcb28f..1b4a310008ad 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -115,7 +115,14 @@ public:
protected:
RefBase();
virtual ~RefBase();
-
+
+ // 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;
+
//! Flags for extendObjectLifetime()
enum {
OBJECT_LIFETIME_WEAK = 0x0001,