diff options
author | Tim Murray <timmurray@google.com> | 2014-04-17 23:33:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-04-17 23:33:58 +0000 |
commit | b429ee5950a4154e58c8ff9d769b3861844bc994 (patch) | |
tree | 7c6ef1392859993405c35eb58c2eeaee6c7d5f58 | |
parent | ba1b9cbd5d0b43d01834a494b48d0559e21fabe1 (diff) | |
parent | fea96e8d145b1915b7bd66f68e973dd572a469e3 (diff) | |
download | rs-b429ee5950a4154e58c8ff9d769b3861844bc994.tar.gz |
Merge "Add error check when init RS thread in sync mode."
-rw-r--r-- | cpp/RenderScript.cpp | 18 | ||||
-rw-r--r-- | rsContext.cpp | 7 |
2 files changed, 17 insertions, 8 deletions
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp index 5709f799..d05e4cd2 100644 --- a/cpp/RenderScript.cpp +++ b/cpp/RenderScript.cpp @@ -58,15 +58,19 @@ RS::~RS() { if (mInit == true) { mMessageRun = false; - RS::dispatch->ContextDeinitToClient(mContext); + if (mContext) { + RS::dispatch->ContextDeinitToClient(mContext); - void *res = NULL; - int status = pthread_join(mMessageThreadId, &res); + void *res = NULL; + int status = pthread_join(mMessageThreadId, &res); - RS::dispatch->ContextDestroy(mContext); - mContext = NULL; - RS::dispatch->DeviceDestroy(mDev); - mDev = NULL; + RS::dispatch->ContextDestroy(mContext); + mContext = NULL; + } + if (mDev) { + RS::dispatch->DeviceDestroy(mDev); + mDev = NULL; + } } } diff --git a/rsContext.cpp b/rsContext.cpp index 290a0909..878daa11 100644 --- a/rsContext.cpp +++ b/rsContext.cpp @@ -580,6 +580,11 @@ bool Context::initContext(Device *dev, const RsSurfaceConfig *sc) { timerSet(RS_TIMER_INTERNAL); if (mSynchronous) { threadProc(this); + + if (mError != RS_ERROR_NONE) { + ALOGE("Errors during thread init (sync mode)"); + return false; + } } else { status = pthread_create(&mThreadId, &threadAttr, threadProc, this); if (status) { @@ -613,7 +618,7 @@ Context::~Context() { } rsAssert(mExit); - if (mHal.funcs.shutdownDriver) { + if (mHal.funcs.shutdownDriver && mHal.drv) { mHal.funcs.shutdownDriver(this); } |