mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Make dc_get_info() work on a closed context
There is very little API guarantees about this, but clients seem to expect *something* to work on a closed context. So split this up into static info an more dynamic context-related info, but let's not provide any guarantees about what keys are available when. Fixes #599
This commit is contained in:
committed by
Floris Bruynooghe
parent
2b46f01fe3
commit
69f1497986
@@ -347,9 +347,12 @@ pub unsafe extern "C" fn dc_get_info(context: *mut dc_context_t) -> *mut libc::c
|
||||
return dc_strdup(ptr::null());
|
||||
}
|
||||
let ffi_context = &*context;
|
||||
ffi_context
|
||||
.with_inner(|ctx| render_info(ctx.get_info()).unwrap_or_default().strdup())
|
||||
.unwrap_or_else(|_| "".strdup())
|
||||
let guard = ffi_context.inner.read().unwrap();
|
||||
let info = match guard.as_ref() {
|
||||
Some(ref ctx) => ctx.get_info(),
|
||||
None => context::get_info(),
|
||||
};
|
||||
render_info(info).unwrap_or_default().strdup()
|
||||
}
|
||||
|
||||
fn render_info(
|
||||
|
||||
Reference in New Issue
Block a user