mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
Try freeing context in dispose method and not wait for finalizer #5043
This commit is contained in:
parent
c6eb55537a
commit
f7b1469462
|
@ -4808,16 +4808,6 @@ namespace Microsoft.Z3
|
||||||
{
|
{
|
||||||
// Console.WriteLine("Context Finalizer from " + System.Threading.Thread.CurrentThread.ManagedThreadId);
|
// Console.WriteLine("Context Finalizer from " + System.Threading.Thread.CurrentThread.ManagedThreadId);
|
||||||
Dispose();
|
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>
|
/// <summary>
|
||||||
|
@ -4847,6 +4837,15 @@ namespace Microsoft.Z3
|
||||||
m_intSort = null;
|
m_intSort = null;
|
||||||
m_realSort = null;
|
m_realSort = null;
|
||||||
m_stringSort = 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
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue