am 83665194: Merge change I9d5e03db into eclair
Merge commit '83665194abceeb7681cb7ac49a4b71aa6e96b1b1' into eclair-mr2 * commit '83665194abceeb7681cb7ac49a4b71aa6e96b1b1': 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.
This commit is contained in:
@@ -54,6 +54,17 @@ Allocation::~Allocation()
|
|||||||
{
|
{
|
||||||
free(mPtr);
|
free(mPtr);
|
||||||
mPtr = NULL;
|
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)
|
void Allocation::setCpuWritable(bool)
|
||||||
|
|||||||
@@ -342,6 +342,9 @@ void * Context::threadProc(void *vrsc)
|
|||||||
rsc->mStateFragmentStore.deinit(rsc);
|
rsc->mStateFragmentStore.deinit(rsc);
|
||||||
ObjectBase::zeroAllUserRef(rsc);
|
ObjectBase::zeroAllUserRef(rsc);
|
||||||
|
|
||||||
|
rsc->mObjDestroy.mNeedToEmpty = true;
|
||||||
|
rsc->objDestroyOOBRun();
|
||||||
|
|
||||||
glClearColor(0,0,0,0);
|
glClearColor(0,0,0,0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
|
eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface);
|
||||||
@@ -350,8 +353,6 @@ void * Context::threadProc(void *vrsc)
|
|||||||
rsc->deinitEGL();
|
rsc->deinitEGL();
|
||||||
pthread_mutex_unlock(&gInitMutex);
|
pthread_mutex_unlock(&gInitMutex);
|
||||||
|
|
||||||
rsc->mObjDestroy.mNeedToEmpty = true;
|
|
||||||
rsc->objDestroyOOBRun();
|
|
||||||
LOGV("RS Thread exited");
|
LOGV("RS Thread exited");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,12 +113,7 @@ bool ObjectBase::decSysRef() const
|
|||||||
|
|
||||||
void ObjectBase::setName(const char *name)
|
void ObjectBase::setName(const char *name)
|
||||||
{
|
{
|
||||||
delete mName;
|
setName(name, strlen(name));
|
||||||
mName = NULL;
|
|
||||||
if (name) {
|
|
||||||
mName = new char[strlen(name) +1];
|
|
||||||
strcpy(mName, name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectBase::setName(const char *name, uint32_t len)
|
void ObjectBase::setName(const char *name, uint32_t len)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
ObjectBaseRef<ProgramRaster> mRaster;
|
ObjectBaseRef<ProgramRaster> mRaster;
|
||||||
ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
|
ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
|
||||||
InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS];
|
InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS];
|
||||||
const char * mScriptText;
|
char * mScriptText;
|
||||||
uint32_t mScriptTextLength;
|
uint32_t mScriptTextLength;
|
||||||
};
|
};
|
||||||
Enviroment_t mEnviroment;
|
Enviroment_t mEnviroment;
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ ScriptC::~ScriptC()
|
|||||||
if (mAccScript) {
|
if (mAccScript) {
|
||||||
accDeleteScript(mAccScript);
|
accDeleteScript(mAccScript);
|
||||||
}
|
}
|
||||||
|
free(mEnviroment.mScriptText);
|
||||||
|
mEnviroment.mScriptText = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptC::setupScript()
|
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)
|
void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len)
|
||||||
{
|
{
|
||||||
ScriptCState *ss = &rsc->mScriptC;
|
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;
|
ss->mScript->mEnviroment.mScriptTextLength = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ public:
|
|||||||
virtual ~ScriptC();
|
virtual ~ScriptC();
|
||||||
|
|
||||||
struct Program_t {
|
struct Program_t {
|
||||||
const char * mScriptText;
|
|
||||||
uint32_t mScriptTextLength;
|
|
||||||
|
|
||||||
|
|
||||||
int mVersionMajor;
|
int mVersionMajor;
|
||||||
int mVersionMinor;
|
int mVersionMinor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user