Octave: fix bugs in output of cleanup code

Closes #35
This commit is contained in:
Karl Wette 2013-04-16 11:11:20 +02:00 committed by William S Fulton
commit 2a3e687c19
2 changed files with 12 additions and 1 deletions

View file

@ -8,6 +8,12 @@ Version 2.0.10 (in progress)
2013-04-17: wsfulton
[C#] Pull patch #34 from BrantKyser to fix smart pointers in conjuction with directors.
2013-04-15: kwwette
[Octave] Fix bugs in output of cleanup code.
- Cleanup code is now written also after the "fail:" label, so it will be called if
a SWIG_exception is raised by the wrapping function, consistent with other modules.
- Octave module now also recognises the "$cleanup" special variable, if needed.
2013-04-08: kwwette
Add -MP option to SWIG for generating phony targets for all dependencies.
- Prevents make from complaining if header files have been deleted before

View file

@ -744,10 +744,15 @@ public:
Delete(tm);
}
Printf(f->code, "fail:\n"); // we should free locals etc if this happens
Printf(f->code, "return _out;\n");
Printf(f->code, "fail:\n"); // we should free locals etc if this happens
Printv(f->code, cleanup, NIL);
Printf(f->code, "return octave_value_list();\n");
Printf(f->code, "}\n");
/* Substitute the cleanup code */
Replaceall(f->code, "$cleanup", cleanup);
Replaceall(f->code, "$symname", iname);
Wrapper_print(f, f_wrappers);
DelWrapper(f);