3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

C API: fixed mk_context/mk_context_rc exception behaviour

Adjusted .NET/Java APIs accordingly.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2013-02-08 18:54:44 +00:00
parent 2e2fa84d40
commit 91402f2060
5 changed files with 33 additions and 19 deletions

View file

@ -419,17 +419,21 @@ namespace api {
extern "C" {
Z3_context Z3_API Z3_mk_context(Z3_config c) {
Z3_TRY;
LOG_Z3_mk_context(c);
memory::initialize(UINT_MAX);
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), false));
RETURN_Z3(r);
Z3_CATCH_RETURN_NO_HANDLE(0);
}
Z3_context Z3_API Z3_mk_context_rc(Z3_config c) {
Z3_TRY;
LOG_Z3_mk_context_rc(c);
memory::initialize(UINT_MAX);
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), true));
RETURN_Z3(r);
Z3_CATCH_RETURN_NO_HANDLE(0);
}
void Z3_API Z3_del_context(Z3_context c) {

View file

@ -26,6 +26,7 @@ Revision History:
#define Z3_CATCH_CORE(CODE) } catch (z3_exception & ex) { mk_c(c)->handle_exception(ex); CODE }
#define Z3_CATCH Z3_CATCH_CORE(return;)
#define Z3_CATCH_RETURN(VAL) Z3_CATCH_CORE(return VAL;)
#define Z3_CATCH_RETURN_NO_HANDLE(VAL) } catch (z3_exception &) { return VAL; }
#define CHECK_REF_COUNT(a) (reinterpret_cast<ast const*>(a)->get_ref_count() > 0)
#define VALIDATE(a) SASSERT(!a || CHECK_REF_COUNT(a))

View file

@ -3053,10 +3053,10 @@ public class Context extends IDisposable
// OK.
}
m_ctx = 0;
} else
/* re-queue the finalizer */
/* BUG: DRQ's need to be taken over too! */
new Context(m_ctx, m_refCount);
}
/*
else
CMW: re-queue the finalizer? */
}
/**