diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2008-03-21 19:34:33 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2008-03-21 19:34:33 +0000 |
| commit | 6a9990e991db7131e00b7ac8e38f4ab2f82c0afd (patch) | |
| tree | 09f79d2ff658938df08552637cfd76cf1b451490 /src/bind/dobinding.cpp | |
| parent | Bugfix to prevent the print dialog falling underneath the inkscape desktop wi... (diff) | |
| download | inkscape-6a9990e991db7131e00b7ac8e38f4ab2f82c0afd.tar.gz inkscape-6a9990e991db7131e00b7ac8e38f4ab2f82c0afd.zip | |
Start working toward multiple inheritance
(bzr r5148)
Diffstat (limited to 'src/bind/dobinding.cpp')
| -rw-r--r-- | src/bind/dobinding.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/bind/dobinding.cpp b/src/bind/dobinding.cpp index 639e27062..6f9010533 100644 --- a/src/bind/dobinding.cpp +++ b/src/bind/dobinding.cpp @@ -75,29 +75,41 @@ typedef struct //# BASE OBJECT //######################################################################## +static jmethodID _getPointer_id = NULL; + static jlong getPointer(JNIEnv *env, jobject obj) { - jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "_pointer", "J"); - if (!id) + if (!_getPointer_id) { - err("getPointer: %s", EXCEPTION); - return 0; - } - jlong val = env->GetLongField(obj, id); + _getPointer_id = env->GetMethodID(env->GetObjectClass(obj), "getPointer", "()J"); + if (!_getPointer_id) + { + err("getPointer(): %s", EXCEPTION); + return 0; + } + } + jlong val = env->CallLongMethod(obj, _getPointer_id); return val; } + +static jmethodID _setPointer_id = NULL; + static void setPointer(JNIEnv *env, jobject obj, jlong val) { - jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "_pointer", "J"); - if (!id) + if (!_setPointer_id) { - err("setPointer: %s", EXCEPTION); - return; + _setPointer_id = env->GetMethodID(env->GetObjectClass(obj), "setPointer", "(J)V"); + if (!_setPointer_id) + { + err("setPointer(): %s", EXCEPTION); + return; + } } - env->SetLongField(obj, id, val); + env->CallVoidMethod(obj, _setPointer_id, val); } + static void JNICALL BaseObject_construct (JNIEnv *env, jobject obj) { @@ -107,7 +119,7 @@ static void JNICALL BaseObject_construct static void JNICALL BaseObject_destruct (JNIEnv *env, jobject obj) { - NodePtr *ptr = (NodePtr *)getPointer(env, obj); + BaseObject *ptr = (BaseObject *)getPointer(env, obj); if (ptr) { delete ptr; |
