summaryrefslogtreecommitdiff
path: root/cpp/RenderScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/RenderScript.cpp')
-rw-r--r--cpp/RenderScript.cpp18
1 files changed, 11 insertions, 7 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;
+ }
}
}