mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 06:16:21 +00:00
fix(ai): use atomic ai_provider_ref() in cmd_ai_switch
src/command/cmd_funcs:11118 used a plain non-atomic ref_count++ on ai_provider, which is a data race against concurrent ai_provider_unref() calls using g_atomic_int_dec_and_test. - Expose ai_provider_ref() in ai_client.h (was static) - Replace non-atomic ref_count++ with ai_provider_ref() in cmd_ai_switch"
This commit is contained in:
@@ -78,6 +78,13 @@ AIProvider* ai_add_provider(const gchar* name, const gchar* api_url, const gchar
|
||||
*/
|
||||
gboolean ai_remove_provider(const gchar* name);
|
||||
|
||||
/**
|
||||
* Increment the reference count of a provider.
|
||||
* @param provider The provider to reference
|
||||
* @return The same provider pointer
|
||||
*/
|
||||
AIProvider* ai_provider_ref(AIProvider* provider);
|
||||
|
||||
/**
|
||||
* Decrement the reference count of a provider.
|
||||
* @param provider The provider to unreference
|
||||
|
||||
Reference in New Issue
Block a user