diff options
author | 2010-09-30 18:15:52 -0700 | |
---|---|---|
committer | 2010-09-30 18:15:52 -0700 | |
commit | f166d9b5a280f0ec2ce7e089471c20a1477e2dbb (patch) | |
tree | 9046963393d9ebc040cf50eb6c4f921130dd2b89 /libs/rs/rsContext.cpp | |
parent | 3cfc508f4ec535b47ffbb587b32a8846c37338cc (diff) |
Add object validity checking.
Change-Id: I2613e87b09a6e560f0381d4ed620d60a10bc30e4
Diffstat (limited to 'libs/rs/rsContext.cpp')
-rw-r--r-- | libs/rs/rsContext.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index cfd64796f093..4752b35fd7ea 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -282,14 +282,14 @@ void * Context::threadProc(void *vrsc) rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms"); rsc->props.mLogVisual = getProp("debug.rs.visual"); - ScriptTLSStruct *tlsStruct = new ScriptTLSStruct; - if (!tlsStruct) { + rsc->mTlsStruct = new ScriptTLSStruct; + if (!rsc->mTlsStruct) { LOGE("Error allocating tls storage"); return NULL; } - tlsStruct->mContext = rsc; - tlsStruct->mScript = NULL; - int status = pthread_setspecific(rsc->gThreadTLSKey, tlsStruct); + rsc->mTlsStruct->mContext = rsc; + rsc->mTlsStruct->mScript = NULL; + int status = pthread_setspecific(rsc->gThreadTLSKey, rsc->mTlsStruct); if (status) { LOGE("pthread_setspecific %i", status); } @@ -361,6 +361,7 @@ void * Context::threadProc(void *vrsc) rsc->deinitEGL(); pthread_mutex_unlock(&gInitMutex); } + delete rsc->mTlsStruct; LOGV("%p, RS Thread exited", rsc); return NULL; @@ -387,6 +388,11 @@ void * Context::helperThreadProc(void *vrsc) #endif setpriority(PRIO_PROCESS, rsc->mWorkers.mNativeThreadId[idx], rsc->mThreadPriority); + int status = pthread_setspecific(rsc->gThreadTLSKey, rsc->mTlsStruct); + if (status) { + LOGE("pthread_setspecific %i", status); + } + while(rsc->mRunning) { rsc->mWorkers.mLaunchSignals[idx].wait(); if (rsc->mWorkers.mLaunchCallback) { |