[libadwaita/wip/chergert/fix-another-null-item] tabview: delay selection change until model updates




commit 194248095e2881e2056829fbc165e501f9777db1
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 5 15:52:25 2021 -0700

    tabview: delay selection change until model updates
    
    We need to ensure the page is available from a GtkSelectionModel before
    we notify or we risk NULL dereferences from the GListModel.

 src/adw-tab-view.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-tab-view.c b/src/adw-tab-view.c
index 25ee6420..57af6a6c 100644
--- a/src/adw-tab-view.c
+++ b/src/adw-tab-view.c
@@ -3261,11 +3261,11 @@ adw_tab_view_attach_page (AdwTabView *self,
 
   attach_page (self, page, position);
 
-  adw_tab_view_set_selected_page (self, page);
-
   if (self->pages)
     g_list_model_items_changed (G_LIST_MODEL (self->pages), position, 0, 1);
 
+  adw_tab_view_set_selected_page (self, page);
+
   end_transfer_for_group (self);
 
   g_object_unref (page);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]