Properly recover from failed compilation.

BUG=5955072

We used to call delete, which did not update the Context's view of the world,
leading to potential segfaults on Context teardown. This change also enables
exceptions to be thrown when runtime errors are encountered.

Change-Id: If63578efff2d7dd03639da1049c1a5ebc69fde35
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index ad10832..03ad5ae 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -837,7 +837,7 @@
                         mRS.mErrorCallback.mErrorNum = subID;
                         mRS.mErrorCallback.run();
                     } else {
-                        //throw new RSRuntimeException("Received error num " + subID + ", details: " + e);
+                        throw new RSRuntimeException("Received error num " + subID + ", details: " + e);
                     }
                     continue;
                 }
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 929dd68..b4eb995 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -322,7 +322,7 @@
 
     if (!s->runCompiler(rsc, resName, cacheDir, (uint8_t *)text, text_length)) {
         // Error during compile, destroy s and return null.
-        delete s;
+        ObjectBase::checkDelete(s);
         return NULL;
     }