mirror of
https://github.com/Z3Prover/z3
synced 2025-06-23 06:13:40 +00:00
Dispose of intermediate Z3Objects created in dotnet api. (#5901)
* Dispose of intermediate Z3Objects created in dotnet api. * Set C# LangVersion to 8.0. * Fix build errors. * Fix warning about empty using statement. * Fix Xor to only dispose of objects that it creates internally.
This commit is contained in:
parent
bdf7de1703
commit
4e0a2f5968
13 changed files with 360 additions and 142 deletions
|
@ -87,7 +87,8 @@ namespace Microsoft.Z3
|
|||
if (Native.Z3_is_as_array(Context.nCtx, n) == 0)
|
||||
throw new Z3Exception("Argument was not an array constant");
|
||||
IntPtr fd = Native.Z3_get_as_array_func_decl(Context.nCtx, n);
|
||||
return FuncInterp(new FuncDecl(Context, fd));
|
||||
using var decl = new FuncDecl(Context, fd);
|
||||
return FuncInterp(decl);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -241,7 +242,7 @@ namespace Microsoft.Z3
|
|||
/// Evaluate expression to a double, assuming it is a numeral already.
|
||||
/// </summary>
|
||||
public double Double(Expr t) {
|
||||
var r = Eval(t, true);
|
||||
using var r = Eval(t, true);
|
||||
return Native.Z3_get_numeral_double(Context.nCtx, r.NativeObject);
|
||||
}
|
||||
|
||||
|
@ -283,7 +284,7 @@ namespace Microsoft.Z3
|
|||
{
|
||||
Debug.Assert(s != null);
|
||||
|
||||
ASTVector av = new ASTVector(Context, Native.Z3_model_get_sort_universe(Context.nCtx, NativeObject, s.NativeObject));
|
||||
using ASTVector av = new ASTVector(Context, Native.Z3_model_get_sort_universe(Context.nCtx, NativeObject, s.NativeObject));
|
||||
return av.ToExprArray();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue