From 24855c09173a6caaec7dcedd0c2d7ce15121d39b Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 6 Jun 2011 09:55:15 -0700 Subject: merge various SF fixes from gingerbread to honeycomb-mr2 (DO NOT MERGE) 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. initial cherry-pick: resolved conflicts for merge of b9783b49 to honeycomb-plus-aosp Change-Id: I2a335e03fff219e35c18a7b0089b3a11d636576f --- include/utils/RefBase.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/utils') diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h index f3550877133f..e88cb29b7f99 100644 --- a/include/utils/RefBase.h +++ b/include/utils/RefBase.h @@ -120,7 +120,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, -- cgit v1.2.3-59-g8ed1b