Revert back to only ffi-level checking of open context

The Rust context is always open, the return value of this function was
simply the wrong way around.
This commit is contained in:
Floris Bruynooghe
2019-09-26 19:29:24 +02:00
committed by holger krekel
parent 8520b5211a
commit 8b7cd2dd1a
2 changed files with 23 additions and 3 deletions

View File

@@ -276,9 +276,11 @@ pub unsafe extern "C" fn dc_is_open(context: *mut dc_context_t) -> libc::c_int {
return 0;
}
let ffi_context = &*context;
ffi_context
.with_inner(|ctx| ctx.sql.is_open() as libc::c_int)
.unwrap_or(0)
let inner_guard = ffi_context.inner.read().unwrap();
match *inner_guard {
Some(_) => 1,
None => 0,
}
}
#[no_mangle]