[libadwaita] leaflet: Fix ordering in children_reversed
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita] leaflet: Fix ordering in children_reversed
- Date: Fri, 2 Apr 2021 07:35:27 +0000 (UTC)
commit 24ebbc4e2dcebea11089e6b5c328582402bb19b4
Author: Alex Angelou <ubuntu1aggelalex gmail com>
Date: Tue Mar 30 22:13:01 2021 +0300
leaflet: Fix ordering in children_reversed
When adding a child, we update the regular child list, then update the
reversed child list using the length of the regular one. However, by the
time we use it, it has already changed as we've just added an element, so
store the length before adding it.
Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/67
Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/88
src/adw-leaflet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-leaflet.c b/src/adw-leaflet.c
index 29655be..eb5cab0 100644
--- a/src/adw-leaflet.c
+++ b/src/adw-leaflet.c
@@ -1684,12 +1684,12 @@ add_page (AdwLeaflet *self,
self->children_reversed = g_list_append (self->children_reversed, page);
} else {
int sibling_pos = g_list_index (self->children, sibling_page);
+ int length = g_list_length (self->children);
self->children =
g_list_insert (self->children, page, sibling_pos + 1);
self->children_reversed =
- g_list_insert (self->children_reversed, page,
- g_list_length (self->children) - sibling_pos - 1);
+ g_list_insert (self->children_reversed, page, length - sibling_pos - 1);
}
if (self->visible_child)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]