From ae02b6dcfcf5678d1d108d625d0b3aebcfeb60bc Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 31 Jul 2026 20:34:10 +0000 Subject: [PATCH] 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(). --- deltachat-ffi/deltachat.h | 10 ---------- deltachat-ffi/src/lib.rs | 12 ------------ 2 files changed, 22 deletions(-) diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index e957bf423..90cbec384 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -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. * diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index d5282a337..5c00be212 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -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]