3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 18:31:49 +00:00

Fixed nested user-propagator callbacks in .NET (#6307)

* Fixed nested user-propagator callbacks in .NET

* Typo
This commit is contained in:
Clemens Eisenhofer 2022-08-29 02:49:15 +02:00 committed by GitHub
parent e2f4fc2307
commit a0ca5d745e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,6 +71,7 @@ namespace Microsoft.Z3
Solver solver;
Context ctx;
Z3_solver_callback callback = IntPtr.Zero;
int callbackNesting = 0;
FixedEh fixed_eh;
Action final_eh;
EqEh eq_eh;
@ -91,6 +92,7 @@ namespace Microsoft.Z3
void Callback(Action fn, Z3_solver_callback cb)
{
this.callbackNesting++;
this.callback = cb;
try
{
@ -102,7 +104,9 @@ namespace Microsoft.Z3
}
finally
{
this.callback = IntPtr.Zero;
callbackNesting--;
if (callbackNesting == 0) // callbacks can be nested (e.g., internalizing new element in "created")
this.callback = IntPtr.Zero;
}
}