From 5469794fd9ad86cd03ba4cf7ef0bc82329362f39 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Tue, 27 Oct 2009 10:24:07 -0700 Subject: Avoid constructing the MutexLocker class to avoid two mystery crashes. --- JavaScriptCore/wtf/Threading.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'JavaScriptCore/wtf') diff --git a/JavaScriptCore/wtf/Threading.h b/JavaScriptCore/wtf/Threading.h index bbfe8b5..72c242f 100644 --- a/JavaScriptCore/wtf/Threading.h +++ b/JavaScriptCore/wtf/Threading.h @@ -259,8 +259,15 @@ public: #if USE(LOCKFREE_THREADSAFESHARED) atomicIncrement(&m_refCount); #else +#if defined ANDROID // avoid constructing a class to avoid two mystery crashes + m_mutex.lock(); +#else MutexLocker locker(m_mutex); +#endif ++m_refCount; +#if defined ANDROID + m_mutex.unlock(); +#endif #endif } @@ -287,9 +294,16 @@ protected: #else int refCount; { +#if defined ANDROID // avoid constructing a class to avoid two mystery crashes + m_mutex.lock(); +#else MutexLocker locker(m_mutex); +#endif --m_refCount; refCount = m_refCount; +#if defined ANDROID + m_mutex.unlock(); +#endif } if (refCount <= 0) return true; -- cgit v1.1