pidgin/pidgin

Fix refs in request page/group list model implementation

14 months ago, Elliott Sales de Andrade
358f8573573f
Parents 97502ddf715f
Children e9a794bfe183
Fix refs in request page/group list model implementation

I messed this up the first time, but no-one was using it at the time, so it wasn't noticed.

Testing Done:
Compiled only.

Reviewed at https://reviews.imfreedom.org/r/2330/
--- a/libpurple/purplerequestgroup.c Tue Mar 07 01:32:24 2023 -0600
+++ b/libpurple/purplerequestgroup.c Thu Mar 09 02:55:35 2023 -0600
@@ -69,10 +69,16 @@
}
static gpointer
-purple_request_group_get_item(G_GNUC_UNUSED GListModel *model, guint index) {
+purple_request_group_get_item(GListModel *model, guint index) {
PurpleRequestGroup *group = PURPLE_REQUEST_GROUP(model);
+ PurpleRequestField *field = NULL;
- return g_list_nth_data(group->fields, index);
+ field = g_list_nth_data(group->fields, index);
+ if(PURPLE_IS_REQUEST_FIELD(field)) {
+ g_object_ref(field);
+ }
+
+ return field;
}
static void
--- a/libpurple/purplerequestpage.c Tue Mar 07 01:32:24 2023 -0600
+++ b/libpurple/purplerequestpage.c Thu Mar 09 02:55:35 2023 -0600
@@ -57,8 +57,14 @@
static gpointer
purple_request_page_get_item(GListModel *model, guint index) {
PurpleRequestPage *page = PURPLE_REQUEST_PAGE(model);
+ PurpleRequestGroup *group = NULL;
- return g_list_nth_data(page->groups, index);
+ group = g_list_nth_data(page->groups, index);
+ if(PURPLE_IS_REQUEST_GROUP(group)) {
+ g_object_ref(group);
+ }
+
+ return group;
}
static void