[gnome-software/1398-gs-details-page-corrent-instance-change-to-a-different-alternative] gs-details-page: Correct instance change to a different alternative
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1398-gs-details-page-corrent-instance-change-to-a-different-alternative] gs-details-page: Correct instance change to a different alternative
- Date: Tue, 31 Aug 2021 15:04:57 +0000 (UTC)
commit 3df738a6322be4f523dff5bbcd6005ee2b9d0016
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 31 17:02:21 2021 +0200
gs-details-page: Correct instance change to a different alternative
When the alternates change the instance, it did not do that through
the _set_app() function, which resulted in showing different GsApp in
different parts of the page and eventually left connected callbacks
on the other GsApp instance and not connected callbacks on the new
GsApp instance.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1398
src/gs-details-page.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index ed25295ca..9acf8733a 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -598,6 +598,8 @@ sort_by_packaging_format_preference (GsApp *app1,
return index1 - index2;
}
+static void _set_app (GsDetailsPage *self, GsApp *app);
+
static void
gs_details_page_get_alternates_cb (GObject *source_object,
GAsyncResult *res,
@@ -702,8 +704,7 @@ gs_details_page_get_alternates_cb (GObject *source_object,
g_strcmp0 (gs_app_get_version (app), gs_app_get_version (self->app)) == 0)) {
/* This can happen on reload of the page */
if (app != self->app) {
- g_clear_object (&self->app);
- self->app = g_object_ref (app);
+ _set_app (self, app);
instance_changed = TRUE;
}
select_row = row;
@@ -727,8 +728,7 @@ gs_details_page_get_alternates_cb (GObject *source_object,
GsApp *app = gs_origin_popover_row_get_app (row);
select_row = origin_row_by_packaging_format;
if (app != self->app) {
- g_clear_object (&self->app);
- self->app = g_object_ref (app);
+ _set_app (self, app);
instance_changed = TRUE;
}
}
@@ -738,8 +738,7 @@ gs_details_page_get_alternates_cb (GObject *source_object,
GsApp *app = gs_origin_popover_row_get_app (row);
select_row = first_row;
if (app != self->app) {
- g_clear_object (&self->app);
- self->app = g_object_ref (app);
+ _set_app (self, app);
instance_changed = TRUE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]