api!: remove dc_chatlist_get_context()

This API is dangerous because returned pointer
is only valid until the chatlist is freed,
and may accidentally be passed into dc_context_unref().
This commit is contained in:
link2xt
2026-07-31 20:34:10 +00:00
committed by l
parent e1f5858fa3
commit ae02b6dcfc
2 changed files with 0 additions and 22 deletions

View File

@@ -3558,16 +3558,6 @@ dc_lot_t* dc_chatlist_get_summary (const dc_chatlist_t* chatlist, siz
dc_lot_t* dc_chatlist_get_summary2 (dc_context_t* context, uint32_t chat_id, uint32_t msg_id);
/**
* Helper function to get the associated context object.
*
* @memberof dc_chatlist_t
* @param chatlist The chatlist object to empty.
* @return The context object associated with the chatlist. NULL if none or on errors.
*/
dc_context_t* dc_chatlist_get_context (dc_chatlist_t* chatlist);
/**
* Get info summary for a chat, in JSON format.
*

View File

@@ -2872,18 +2872,6 @@ pub unsafe extern "C" fn dc_chatlist_get_summary2(
Box::into_raw(Box::new(summary.into()))
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn dc_chatlist_get_context(
chatlist: *mut dc_chatlist_t,
) -> *const dc_context_t {
if chatlist.is_null() {
eprintln!("ignoring careless call to dc_chatlist_get_context()");
return ptr::null_mut();
}
let ffi_list = unsafe { &*chatlist };
ffi_list.context
}
// dc_chat_t
/// FFI struct for [dc_chat_t]