diff options
author | Jason Sams <rjsams@android.com> | 2009-11-03 15:26:09 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-11-03 15:26:09 -0800 |
commit | 74807763e00df50915b0d6934e5f37a43b614240 (patch) | |
tree | 2b30a1f35d3ef40a0fa7f8738a6b590d8810b575 /libs/rs | |
parent | b4229d4b0600f210e540f76605e1d85dc98172e3 (diff) | |
parent | 03fa848afd16ee678e2d04ec824794893f199804 (diff) | |
download | frameworks_base-74807763e00df50915b0d6934e5f37a43b614240.zip frameworks_base-74807763e00df50915b0d6934e5f37a43b614240.tar.gz frameworks_base-74807763e00df50915b0d6934e5f37a43b614240.tar.bz2 |
am 03fa848a: am ebca5eec: am 83665194: Merge change I9d5e03db into eclair
Merge commit '03fa848afd16ee678e2d04ec824794893f199804'
* commit '03fa848afd16ee678e2d04ec824794893f199804':
Fix RS bugs. We were holding a pointer to the script text from the java vm. Move freeing of objects to before context teardown to allow allocations to clean up their data.
Diffstat (limited to 'libs/rs')
-rw-r--r-- | libs/rs/rsAllocation.cpp | 11 | ||||
-rw-r--r-- | libs/rs/rsContext.cpp | 5 | ||||
-rw-r--r-- | libs/rs/rsObjectBase.cpp | 7 | ||||
-rw-r--r-- | libs/rs/rsScript.h | 2 | ||||
-rw-r--r-- | libs/rs/rsScriptC.cpp | 8 | ||||
-rw-r--r-- | libs/rs/rsScriptC.h | 4 |
6 files changed, 23 insertions, 14 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index 75b4462..6605ea9 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -54,6 +54,17 @@ Allocation::~Allocation() { free(mPtr); mPtr = NULL; + + if (mBufferID) { + // Causes a SW crash.... + //LOGV(" mBufferID %i", mBufferID); + //glDeleteBuffers(1, &mBufferID); + //mBufferID = 0; + } + if (mTextureID) { + glDeleteTextures(1, &mTextureID); + mTextureID = 0; + } } void Allocation::setCpuWritable(bool) diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index 40e3c4a..dbe50de 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -342,6 +342,9 @@ void * Context::threadProc(void *vrsc) rsc->mStateFragmentStore.deinit(rsc); ObjectBase::zeroAllUserRef(rsc); + rsc->mObjDestroy.mNeedToEmpty = true; + rsc->objDestroyOOBRun(); + glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT); eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface); @@ -350,8 +353,6 @@ void * Context::threadProc(void *vrsc) rsc->deinitEGL(); pthread_mutex_unlock(&gInitMutex); - rsc->mObjDestroy.mNeedToEmpty = true; - rsc->objDestroyOOBRun(); LOGV("RS Thread exited"); return NULL; } diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp index 1b442ba..b7d67cc 100644 --- a/libs/rs/rsObjectBase.cpp +++ b/libs/rs/rsObjectBase.cpp @@ -113,12 +113,7 @@ bool ObjectBase::decSysRef() const void ObjectBase::setName(const char *name) { - delete mName; - mName = NULL; - if (name) { - mName = new char[strlen(name) +1]; - strcpy(mName, name); - } + setName(name, strlen(name)); } void ObjectBase::setName(const char *name, uint32_t len) diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h index 8aa4542..bc40854 100644 --- a/libs/rs/rsScript.h +++ b/libs/rs/rsScript.h @@ -54,7 +54,7 @@ public: ObjectBaseRef<ProgramRaster> mRaster; ObjectBaseRef<ProgramFragmentStore> mFragmentStore; InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS]; - const char * mScriptText; + char * mScriptText; uint32_t mScriptTextLength; }; Enviroment_t mEnviroment; diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 9da7766..073d98b 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -46,6 +46,8 @@ ScriptC::~ScriptC() if (mAccScript) { accDeleteScript(mAccScript); } + free(mEnviroment.mScriptText); + mEnviroment.mScriptText = NULL; } void ScriptC::setupScript() @@ -404,7 +406,11 @@ void rsi_ScriptCSetScript(Context * rsc, void *vp) void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len) { ScriptCState *ss = &rsc->mScriptC; - ss->mScript->mEnviroment.mScriptText = text; + + char *t = (char *)malloc(len + 1); + memcpy(t, text, len); + t[len] = 0; + ss->mScript->mEnviroment.mScriptText = t; ss->mScript->mEnviroment.mScriptTextLength = len; } diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h index ae124b4..69afc18 100644 --- a/libs/rs/rsScriptC.h +++ b/libs/rs/rsScriptC.h @@ -41,10 +41,6 @@ public: virtual ~ScriptC(); struct Program_t { - const char * mScriptText; - uint32_t mScriptTextLength; - - int mVersionMajor; int mVersionMinor; |