Various director fixes submitted by Scott Michel

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5128 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-09-19 23:19:47 +00:00
commit e09ec943f5
2 changed files with 221 additions and 91 deletions

View file

@ -18,6 +18,8 @@ class __DIRECTOR__ {
private:
/* pointer to java virtual machine */
JavaVM *__jvm;
/* the default constructor should not be called */
__DIRECTOR__();
protected:
/* pointer to the wrapped java object */
@ -31,11 +33,6 @@ protected:
}
public:
/* the default constructor should not be called */
__DIRECTOR__() : __jvm(NULL), __self(NULL) {
assert(0);
}
/* Default constructor */
__DIRECTOR__(JNIEnv *jenv):
__jvm((JavaVM *) NULL),
@ -49,9 +46,13 @@ public:
virtual ~__DIRECTOR__()
{
if (__self) {
JNIEnv *jenv;
JNIEnv *jenv;
jmethodID disconn_meth;
jenv = __acquire_jenv();
disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(__self), "__director_disconnect", "()V");
if (disconn_meth)
jenv->CallVoidMethod(__self, disconn_meth);
jenv->DeleteGlobalRef(__self);
__self = (jobject) NULL;
}