diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 3c4a8bba2..e272e9662 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -466,6 +466,7 @@ public: int newobj = Getattr(n,"feature:new") ? 1 : 0; String *nodeType = Getattr(n, "nodeType"); int constructor = !Cmp(nodeType, "constructor"); + int destructor = (!Cmp(nodeType, "destructor")); String *storage = Getattr(n,"storage"); int isVirtual = !Cmp(storage,"virtual"); String *overname = 0; @@ -686,9 +687,10 @@ public: // (the smart-pointer) and the director object (the "pointee") are // distinct. - if (CPlusPlus && directorsEnabled()) { - if (!is_smart_pointer()) { - if (/*directorbase &&*/ !constructor && isVirtual) { + if (directorsEnabled()) { + if (!is_smart_pointer()) { + if (/*directorbase &&*/ !constructor && !destructor + && isVirtual && !Getattr(n,"feature:nodirector")) { Wrapper_add_local(f, "director", "Swig::Director *director = 0"); Printf(f->code, "director = dynamic_cast(arg1);\n"); diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 1037d865a..892293166 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -1076,7 +1076,8 @@ public: if (directorsEnabled()) { if (!is_smart_pointer()) { - if (/*directorbase &&*/ !constructor && !destructor && isVirtual) { + if (/*directorbase &&*/ !constructor && !destructor + && isVirtual && !Getattr(n,"feature:nodirector")) { Wrapper_add_local(f, "director", "Swig::Director *director = 0"); Printf(f->code, "director = dynamic_cast(arg1);\n"); Printf(f->code, "if (director && (director->swig_get_self() == self)) director->swig_set_up();\n");