[gnome-notes/132-own-nextcloud-notes-can-t-be-clicked-after-created: 3/3] controller: Fix missing notes



commit b8d4251640f89d37f32083c98f47b0b60e445aad
Author: Isaque Galdino <igaldino gmail com>
Date:   Wed Aug 28 00:37:04 2019 -0300

    controller: Fix missing notes
    
    The sort process of the main view was missing some notes after a user
    updated them.
    
    The issue was found when we noticed the sorting was done on a temporary
    object instead of the main one. g_list_sort might change the start of
    the list during the sorting process and when that happened it changed
    the temporary object. As the main object was not changed, it continued
    to point to the same node as before, which then was the second one. So,
    when the update view function used the main object, it started from the
    second node, instead of the first one.
    
    This commit fixes that, removing the temporary object from the process.

 src/bjb-controller.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index 733a1d0..c8b55bc 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -379,22 +379,20 @@ sort_items (GList **to_show)
 void
 bjb_controller_update_view (BjbController *self)
 {
-  GList *items, *l;
+  GList *l;
   BjbWindowViewType type;
 
-
   /* Do not update if nothing to show */
   type = bjb_window_base_get_view_type (self->window);
   if (! (type == BJB_WINDOW_BASE_MAIN_VIEW
          || type == BJB_WINDOW_BASE_ARCHIVE_VIEW))
     return;
 
-  items = self->items_to_show;
   free_items_store (self);
 
-  sort_items (&items);
+  sort_items (&self->items_to_show);
 
-  for (l = items; l != NULL; l = l->next)
+  for (l = self->items_to_show; l != NULL; l = l->next)
   {
     bjb_controller_add_item (self, l->data, FALSE, NULL);
   }


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