From 0d2b2d5e13ef4dcff89a28b4d6b25d5f0a05b96d Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Fri, 15 Oct 2010 11:21:24 -0700 Subject: Fix deadlock on RS teardown. Change-Id: I34d2702b535e28e9519c7368fd8a942bfe0724bc --- libs/rs/rsObjectBase.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'libs/rs/rsObjectBase.cpp') diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp index e4b07c4c3d97..46b1750f6c5b 100644 --- a/libs/rs/rsObjectBase.cpp +++ b/libs/rs/rsObjectBase.cpp @@ -93,9 +93,8 @@ bool ObjectBase::checkDelete() const if (mRSC && mRSC->props.mLogObjects) { dumpLOGV("checkDelete"); } - delete this; - unlockUserRef(); + delete this; return true; } return false; @@ -170,9 +169,7 @@ void ObjectBase::add() const void ObjectBase::remove() const { - // Should be within gObjectInitMutex lock - // lock will be from checkDelete a few levels up in the stack. - + lockUserRef(); //LOGV("calling remove rsc %p", mRSC); if (!mRSC) { rsAssert(!mPrev); @@ -191,12 +188,11 @@ void ObjectBase::remove() const } mPrev = NULL; mNext = NULL; + unlockUserRef(); } void ObjectBase::zeroAllUserRef(Context *rsc) { - lockUserRef(); - if (rsc->props.mLogObjects) { LOGV("Forcing release of all outstanding user refs."); } @@ -219,8 +215,6 @@ void ObjectBase::zeroAllUserRef(Context *rsc) LOGV("Objects remaining."); dumpAll(rsc); } - - unlockUserRef(); } void ObjectBase::dumpAll(Context *rsc) -- cgit v1.2.3-59-g8ed1b