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:
parent
42945de240
commit
58fad41dfa
5 changed files with 6 additions and 149 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue