diff --git a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_joints_PhysicsJoint.cpp b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_joints_PhysicsJoint.cpp index 129865034..b00425e88 100644 --- a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_joints_PhysicsJoint.cpp +++ b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_joints_PhysicsJoint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2018 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +56,22 @@ extern "C" { return joint->getAppliedImpulse(); } + /* + * Class: com_jme3_bullet_joints_PhysicsJoint + * Method: finalizeNative + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_PhysicsJoint_finalizeNative + (JNIEnv * env, jobject object, jlong jointId) { + btTypedConstraint* joint = reinterpret_cast (jointId); + if (joint == NULL) { + jclass newExc = env->FindClass("java/lang/NullPointerException"); + env->ThrowNew(newExc, "The native object does not exist."); + return; + } + delete(joint); + } + #ifdef __cplusplus } #endif