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:
idk%eng.sun.com
2000-02-09 00:34:54 +00:00
parent 1cc83d0375
commit 818eb6a8db
3 changed files with 18 additions and 9 deletions

View File

@@ -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;
}