Merge branch 'ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn'
* ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn: [OCaml] Fix possible GC issues in generated director code Conflicts: Examples/test-suite/ocaml/director_unroll_runme.ml
This commit is contained in:
commit
9ab873f432
2 changed files with 15 additions and 16 deletions
|
|
@ -1405,8 +1405,7 @@ public:
|
|||
pure_virtual = true;
|
||||
}
|
||||
}
|
||||
|
||||
Wrapper_add_local(w, "swig_result", "CAMLparam0();\n" "SWIG_CAMLlocal2(swig_result,args)");
|
||||
Printf(w->locals, "CAMLparam0();\n");
|
||||
|
||||
/* determine if the method returns a pointer */
|
||||
is_pointer = SwigType_ispointer_return(decl);
|
||||
|
|
@ -1480,16 +1479,18 @@ public:
|
|||
|
||||
if (ignored_method) {
|
||||
if (!pure_virtual) {
|
||||
if (!is_void)
|
||||
Printf(w->code, "return ");
|
||||
String *super_call = Swig_method_call(super, l);
|
||||
Printf(w->code, "%s;\n", super_call);
|
||||
if (is_void)
|
||||
Printf(w->code, "%s;\n", super_call);
|
||||
else
|
||||
Printf(w->code, "CAMLreturn_type(%s);\n", super_call);
|
||||
Delete(super_call);
|
||||
} else {
|
||||
Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"Attempted to invoke pure virtual method %s::%s\");\n", SwigType_namestr(c_classname),
|
||||
SwigType_namestr(name));
|
||||
}
|
||||
} else {
|
||||
Wrapper_add_local(w, "swig_result", "SWIG_CAMLlocal2(swig_result, args)");
|
||||
/* attach typemaps to arguments (C/C++ -> Ocaml) */
|
||||
String *arglist = NewString("");
|
||||
|
||||
|
|
@ -1686,6 +1687,8 @@ public:
|
|||
Printf(w->code, "CAMLreturn_type(*c_result);\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Printf(w->code, "CAMLreturn0;\n");
|
||||
}
|
||||
|
||||
Printf(w->code, "}\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue