3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 12:28:44 +00:00

Try freeing context in dispose method and not wait for finalizer #5043

This commit is contained in:
Nikolaj Bjorner 2021-02-27 11:02:58 -08:00
parent c6eb55537a
commit f7b1469462

View file

@ -4808,16 +4808,6 @@ namespace Microsoft.Z3
{
// Console.WriteLine("Context Finalizer from " + System.Threading.Thread.CurrentThread.ManagedThreadId);
Dispose();
if (refCount == 0 && m_ctx != IntPtr.Zero)
{
m_n_err_handler = null;
IntPtr ctx = m_ctx;
m_ctx = IntPtr.Zero;
Native.Z3_del_context(ctx);
}
else
GC.ReRegisterForFinalize(this);
}
/// <summary>
@ -4847,6 +4837,15 @@ namespace Microsoft.Z3
m_intSort = null;
m_realSort = null;
m_stringSort = null;
if (refCount == 0 && m_ctx != IntPtr.Zero)
{
m_n_err_handler = null;
IntPtr ctx = m_ctx;
m_ctx = IntPtr.Zero;
Native.Z3_del_context(ctx);
}
else
GC.ReRegisterForFinalize(this);
}
#endregion
}