Fixed crasher bug.
Now PlugletEngine do not crache mozilla in case of missing jvm git-svn-id: svn://10.0.0.236/trunk@60166 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -21,7 +21,7 @@ List::List() {
|
||||
|
||||
List::~List() {
|
||||
ListNode *tmp;
|
||||
for(ListNode * current=head;!current;tmp = current,current = current->next, delete tmp)
|
||||
for(ListNode * current=head; current != NULL ;tmp = current,current = current->next, delete tmp)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ void PlugletEngine::StartJVM(void) {
|
||||
#endif /* OJI_DISABLE */
|
||||
|
||||
JNIEnv * PlugletEngine::GetJNIEnv(void) {
|
||||
JNIEnv * res;
|
||||
JNIEnv * res = NULL;
|
||||
#ifndef OJI_DISABLE
|
||||
nsresult result;
|
||||
if (!jvmManager) {
|
||||
@@ -217,18 +217,22 @@ JNIEnv * PlugletEngine::GetJNIEnv(void) {
|
||||
if (!jvmManager) {
|
||||
return NULL;
|
||||
}
|
||||
jvmManager->CreateProxyJNI(NULL,&res);
|
||||
if (NS_FAILED(jvmManager->CreateProxyJNI(NULL,&res))) {
|
||||
return NULL;
|
||||
}
|
||||
if (!securityContext) {
|
||||
securityContext = new PlugletSecurityContext();
|
||||
}
|
||||
SetSecurityContext(res,securityContext);
|
||||
#else /* OJI_DISABLE */
|
||||
if (!jvm) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletEngine::GetJNIEnv going to start our own jvm \n"));
|
||||
StartJVM();
|
||||
if (!jvm) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletEngine::GetJNIEnv going to start our own jvm \n"));
|
||||
StartJVM();
|
||||
}
|
||||
if (jvm) {
|
||||
jvm->AttachCurrentThread(&res,NULL);
|
||||
}
|
||||
jvm->AttachCurrentThread(&res,NULL);
|
||||
#endif /* OJI_DISABLE */
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ void PlugletLoader::Initialize(void) {
|
||||
("PlugletLoader::Initialize\n"));
|
||||
//nb erors handling
|
||||
JNIEnv * env = PlugletEngine::GetJNIEnv();
|
||||
if (!env) {
|
||||
return;
|
||||
}
|
||||
clazz = env->FindClass("org/mozilla/pluglet/PlugletLoader");
|
||||
if (env->ExceptionOccurred()) {
|
||||
env->ExceptionDescribe();
|
||||
@@ -75,7 +78,9 @@ void PlugletLoader::Destroy(void) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletLoader::destroy\n"));
|
||||
JNIEnv * env = PlugletEngine::GetJNIEnv();
|
||||
env->DeleteGlobalRef(clazz);
|
||||
if (env) {
|
||||
env->DeleteGlobalRef(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
char * PlugletLoader::GetMIMEDescription(const char * path) {
|
||||
|
||||
Reference in New Issue
Block a user