mirror of
https://github.com/Z3Prover/z3
synced 2025-06-05 21:53:23 +00:00
Fixed nested user-propagator callbacks in .NET (#6307)
* Fixed nested user-propagator callbacks in .NET * Typo
This commit is contained in:
parent
e2f4fc2307
commit
a0ca5d745e
1 changed files with 5 additions and 1 deletions
|
@ -71,6 +71,7 @@ namespace Microsoft.Z3
|
||||||
Solver solver;
|
Solver solver;
|
||||||
Context ctx;
|
Context ctx;
|
||||||
Z3_solver_callback callback = IntPtr.Zero;
|
Z3_solver_callback callback = IntPtr.Zero;
|
||||||
|
int callbackNesting = 0;
|
||||||
FixedEh fixed_eh;
|
FixedEh fixed_eh;
|
||||||
Action final_eh;
|
Action final_eh;
|
||||||
EqEh eq_eh;
|
EqEh eq_eh;
|
||||||
|
@ -91,6 +92,7 @@ namespace Microsoft.Z3
|
||||||
|
|
||||||
void Callback(Action fn, Z3_solver_callback cb)
|
void Callback(Action fn, Z3_solver_callback cb)
|
||||||
{
|
{
|
||||||
|
this.callbackNesting++;
|
||||||
this.callback = cb;
|
this.callback = cb;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -102,7 +104,9 @@ namespace Microsoft.Z3
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
this.callback = IntPtr.Zero;
|
callbackNesting--;
|
||||||
|
if (callbackNesting == 0) // callbacks can be nested (e.g., internalizing new element in "created")
|
||||||
|
this.callback = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue