summaryrefslogtreecommitdiff
path: root/native/jni
diff options
context:
space:
mode:
authorIan Rogers <ian.rogers@manchester.ac.uk>2007-11-23 15:28:52 +0000
committerIan Rogers <ian.rogers@manchester.ac.uk>2007-11-23 15:28:52 +0000
commit54bfc2536133500a7f4e2a040c87df43a4ac05a3 (patch)
tree75458171613e409010a99317b56a5e67e59cc44d /native/jni
parent5be0439c7247163fc4e62afb88afba2c869ebce1 (diff)
downloadclasspath-54bfc2536133500a7f4e2a040c87df43a4ac05a3.tar.gz
Make pointerClass a global JNI reference when pointers are 4 bytes wide and not just 8 bytes wide.
Diffstat (limited to 'native/jni')
-rw-r--r--native/jni/gtk-peer/gtkpeer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/native/jni/gtk-peer/gtkpeer.c b/native/jni/gtk-peer/gtkpeer.c
index c99fc48f9..b57626e94 100644
--- a/native/jni/gtk-peer/gtkpeer.c
+++ b/native/jni/gtk-peer/gtkpeer.c
@@ -102,11 +102,13 @@ void gtkpeer_init_pointer_IDs(JNIEnv* env)
#else
#if SIZEOF_VOID_P == 4
pointerClass = (*env)->FindClass(env, "gnu/classpath/Pointer32");
- pointerDataFID = (*env)->GetFieldID(env, pointerClass, "data", "I");
-
- /* Find the Pointer32 constructor. */
- pointerConstructorMID = (*env)->GetMethodID(env, pointerClass, "<init>",
- "(I)V");
+ if (pointerClass != NULL)
+ {
+ pointerClass = (*env)->NewGlobalRef (env, pointerClass);
+ pointerDataFID = (*env)->GetFieldID (env, pointerClass, "data", "I");
+ pointerConstructorMID = (*env)->GetMethodID (env, pointerClass, "<init>",
+ "(I)V");
+ }
#else
#error "Pointer size is not supported."
#endif /* SIZEOF_VOID_P == 4 */