From 2074dc3febdc0b09bf6d292d85163dd3d789f2fb Mon Sep 17 00:00:00 2001 From: Gary Kramlich Date: Mon, 10 Apr 2023 23:47:15 -0500 Subject: 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/ --- libpurple/purplecontactmanager.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libpurple') diff --git a/libpurple/purplecontactmanager.c b/libpurple/purplecontactmanager.c index bc7025531c..2f1c9478b1 100644 --- a/libpurple/purplecontactmanager.c +++ b/libpurple/purplecontactmanager.c @@ -650,19 +650,18 @@ void 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); } -- cgit v1.2.1