summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2014-04-17 23:33:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-04-17 23:33:58 +0000
commitb429ee5950a4154e58c8ff9d769b3861844bc994 (patch)
tree7c6ef1392859993405c35eb58c2eeaee6c7d5f58
parentba1b9cbd5d0b43d01834a494b48d0559e21fabe1 (diff)
parentfea96e8d145b1915b7bd66f68e973dd572a469e3 (diff)
downloadrs-b429ee5950a4154e58c8ff9d769b3861844bc994.tar.gz
Merge "Add error check when init RS thread in sync mode."
-rw-r--r--cpp/RenderScript.cpp18
-rw-r--r--rsContext.cpp7
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);
}