pidgin/pidgin

Parents c68c3ce47da8
Children 2273647d24b0
Fix the issue where the contact list would sometimes duplicate everyone

Testing Done:
This was tested with another review request that was reproducing it 100% of the time.

Reviewed at https://reviews.imfreedom.org/r/2431/
--- a/libpurple/purplecontactmanager.c Fri Apr 07 00:49:29 2023 -0500
+++ b/libpurple/purplecontactmanager.c Mon Apr 10 23:47:15 2023 -0500
@@ -650,19 +650,18 @@
purple_contact_manager_add_person(PurpleContactManager *manager,
PurplePerson *person)
{
- guint index = 0;
-
g_return_if_fail(PURPLE_IS_CONTACT_MANAGER(manager));
g_return_if_fail(PURPLE_IS_PERSON(person));
/* If the person is already known, bail. */
- if(g_ptr_array_find(manager->people, person, &index)) {
+ if(g_ptr_array_find(manager->people, person, NULL)) {
return;
}
/* Add the person and emit our signals. */
g_ptr_array_add(manager->people, g_object_ref(person));
- g_list_model_items_changed(G_LIST_MODEL(manager), index, 0, 1);
+ g_list_model_items_changed(G_LIST_MODEL(manager), manager->people->len - 1,
+ 0, 1);
g_signal_emit(manager, signals[SIG_PERSON_ADDED], 0, person);
}