diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2013-11-26 15:25:59 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2013-11-26 15:25:59 -0500 |
commit | 6b120f130cb41f45151b9418a679850775a16ef7 (patch) | |
tree | b1e5625709518b10c68f4748b30ab4976dc3e303 /src/expr | |
parent | 1e672c98d29991c4925138ad015bb7e2fef59e46 (diff) |
Fix Java destruction order issue; thanks to Zheng Manchun for reporting this bug.
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/expr_manager.i | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/expr/expr_manager.i b/src/expr/expr_manager.i index 8e601a396..6fb802497 100644 --- a/src/expr/expr_manager.i +++ b/src/expr/expr_manager.i @@ -2,6 +2,27 @@ #include "expr/expr_manager.h" %} +%typemap(javacode) CVC4::ExprManager %{ + // a ref is kept here to keep Java GC from collecting the Options + // before the ExprManager + private Object options; +%} +%typemap(javaconstruct) ExprManager(Options options) { + this($imcall, true); + this.options = SmtEngine.mkRef(options); // keep ref to options in SWIG proxy class + } +%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized") CVC4::ExprManager { + SmtEngine.dlRef(options); + options = null; + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + CVC4JNI.delete_SmtEngine(swigCPtr); + } + swigCPtr = 0; + } + } + #ifdef SWIGOCAML /* OCaml bindings cannot deal with this degree of overloading */ %ignore CVC4::ExprManager::mkExpr(Kind, const std::vector<Expr>&); |