mirror of
https://github.com/chatmail/core.git
synced 2026-08-12 09:54:32 +03:00
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:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user