summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kramlich <grim@reaperworld.com>2023-04-10 23:47:15 -0500
committerGary Kramlich <grim@reaperworld.com>2023-04-10 23:47:15 -0500
commit2074dc3febdc0b09bf6d292d85163dd3d789f2fb (patch)
treeeb5a97c1566031a0a8ef3aea8a7a7d735c1f3b14
parenta7d28aa53a772a950f79d189310b32a3a765c007 (diff)
downloadpidgin-2074dc3febdc0b09bf6d292d85163dd3d789f2fb.tar.gz
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/
-rw-r--r--libpurple/purplecontactmanager.c7
1 files changed, 3 insertions, 4 deletions
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);
}