3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-28 08:58:44 +00:00

Dotnet Api: Fix infinite finalization of Context (#6361)

* Dotnet Api: suppress GC finalization of dotnet context in favor of re-registering finalization

* Dotnet Api: enable concurrent dec-ref even if context is created without parameters.

* Dotnet Api: removed dead code.
This commit is contained in:
Peter Bruch 2022-09-22 20:25:17 +02:00 committed by GitHub
parent 42945de240
commit 58fad41dfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 149 deletions

View file

@ -50,10 +50,7 @@ namespace Microsoft.Z3
m_n_obj = IntPtr.Zero;
}
if (m_ctx != null)
{
m_ctx = null;
}
m_ctx = null;
GC.SuppressFinalize(this);
}
@ -81,8 +78,8 @@ namespace Microsoft.Z3
{
Debug.Assert(ctx != null);
m_ctx = ctx;
IncRef(obj);
m_n_obj = obj;
IncRef(obj);
}
internal virtual void IncRef(IntPtr o) { }
@ -103,7 +100,7 @@ namespace Microsoft.Z3
internal static IntPtr GetNativeObject(Z3Object s)
{
if (s == null) return new IntPtr();
if (s == null) return IntPtr.Zero;
return s.NativeObject;
}