From 42d53349ef5c8c6fea7d401921fa16ce0b4958b4 Mon Sep 17 00:00:00 2001 From: clay_shooter Date: Sat, 24 Mar 2007 14:58:47 +0000 Subject: [PATCH] SF1687419 AttachCurrentThread was being passed incorrect parameters. The 1.2 API implementation has never been correct. --- jni/EventProxy.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jni/EventProxy.cpp b/jni/EventProxy.cpp index 644db33..c7b20aa 100644 --- a/jni/EventProxy.cpp +++ b/jni/EventProxy.cpp @@ -66,7 +66,11 @@ EventProxy::~EventProxy() if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} if (vmConnectionStatus == JNI_EDETACHED){ //printf("Unhook: Attaching to current thread using JNI Version 1.2 (%d)\n",vmConnectionStatus); - jvm->AttachCurrentThread((void **)&env, jvm); + JavaVMAttachArgs attachmentArgs; + attachmentArgs.version = JNI_VERSION_1_2; + attachmentArgs.name = NULL; + attachmentArgs.group = NULL; + jvm->AttachCurrentThread((void **)&env, &attachmentArgs); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} } else { // should really look for JNI_OK versus an error @@ -140,7 +144,11 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid, // attach to the current running thread //printf("Invoke: Attaching to current thread using JNI Version 1.2\n"); - jvm->AttachCurrentThread((void **)&env, jvm); + JavaVMAttachArgs attachmentArgs; + attachmentArgs.version = JNI_VERSION_1_2; + attachmentArgs.name = NULL; + attachmentArgs.group = NULL; + jvm->AttachCurrentThread((void **)&env, &attachmentArgs); if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} if (!eventMethodName)