Fix refcounting bugs where the sys refcount
could be corrupted during async type creation.

Change-Id: If42828e92990598b0cb5da81c82ea513f94725f2

Fix stack object deletion bug.

Change-Id: I2c723aa5ad15e0c99dc9cd0cfbc7db80bace172a
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 9e6fbd5..dc021fc 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -30,8 +30,6 @@
 Element::Element(Context *rsc) : ObjectBase(rsc)
 {
     mBits = 0;
-    mAllocFile = __FILE__;
-    mAllocLine = __LINE__;
     mFields = NULL;
     mFieldCount = 0;
     mHasReference = false;
@@ -140,7 +138,7 @@
     for (uint32_t ct=0; ct < rsc->mStateElement.mElements.size(); ct++) {
         Element *ee = rsc->mStateElement.mElements[ct];
         if(ee->isEqual(elem)) {
-            delete elem;
+            ObjectBase::checkDelete(elem);
             ee->incUserRef();
             return ee;
         }