mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 04:28:17 +00:00
parent
58d3329190
commit
2d3c12716a
|
@ -370,16 +370,15 @@ public class Context extends IDisposable
|
|||
* Update a datatype field at expression t with value v.
|
||||
* The function performs a record update at t. The field
|
||||
* that is passed in as argument is updated with value v,
|
||||
* the remainig fields of t are unchanged.
|
||||
* the remainig fields of t are unchanged.
|
||||
**/
|
||||
public Expr MkUpdateField(FuncDecl field, Expr t, Expr v)
|
||||
throws Z3Exception
|
||||
throws Z3Exception
|
||||
{
|
||||
return Expr.create
|
||||
(this,
|
||||
Native.datatypeUpdateField
|
||||
(nCtx(), field.getNativeObject(),
|
||||
t.getNativeObject(), v.getNativeObject()));
|
||||
return Expr.create (this,
|
||||
Native.datatypeUpdateField
|
||||
(nCtx(), field.getNativeObject(),
|
||||
t.getNativeObject(), v.getNativeObject()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3777,18 +3776,6 @@ public class Context extends IDisposable
|
|||
{
|
||||
try {
|
||||
dispose();
|
||||
|
||||
if (m_refCount.get() == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Native.delContext(m_ctx);
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
// OK.
|
||||
}
|
||||
m_ctx = 0;
|
||||
}
|
||||
}
|
||||
catch (Throwable t) {
|
||||
throw t;
|
||||
|
@ -3821,5 +3808,15 @@ public class Context extends IDisposable
|
|||
m_boolSort = null;
|
||||
m_intSort = null;
|
||||
m_realSort = null;
|
||||
|
||||
if (m_refCount.get() == 0) {
|
||||
try {
|
||||
Native.delContext(m_ctx);
|
||||
} catch (Z3Exception e) {
|
||||
// OK?
|
||||
System.out.println("Context deletion failed; memory leak possible.");
|
||||
}
|
||||
m_ctx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ public class Z3Object extends IDisposable
|
|||
|
||||
if (m_ctx != null)
|
||||
{
|
||||
m_ctx.m_refCount.decrementAndGet();
|
||||
if (m_ctx.m_refCount.decrementAndGet() == 0)
|
||||
m_ctx.dispose();
|
||||
m_ctx = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue