[nautilus/gnome-3-22] canvas-container: fix auto_layout desktop crash



commit 17314900d88ef08227d14413f96781341796705f
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Tue Feb 21 19:15:46 2017 +0200

    canvas-container: fix auto_layout desktop crash
    
    When the metadata of the desktop needs to be recalculated or it's
    missing, we need to reposition the icons. They have what we call a
    "lazy position". In order to place them on the desktop we either
    position them by it's saved position if possible, and if not, moving
    them as close as possible without overlaping, or by what we call
    "auto layout", which is basically a perfect grid similar to a regular
    nautilus window. It's clear from this logic that we do either one way
    to place them or the other, and both at the same time doesn't make
    sense. For that we assert we just apply one of this placements
    algorythms. However, we were hitting this assertion if desktop-metadata
    was missing (so they have a lazy position) since we need to reorder the
    icons using the auto layout algorthm but the code was also trying to do
    the "saved position" algorythm.
    
    This issue is introduced by a commit intended to avoid overlapping icons,
    with id: 40c79aec2d2fdc860eadab9b59682ae0b04d5131. In the initial
    implementation of "lazy position" support, if "auto layout" was chosen,
    the icons were repositioned only by the "auto layout" algorithm.
    
    To fix this re-add the check that repositions icons only by the
    "auto layout" algorithm if "auto layout" is chosen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747662

 src/nautilus-canvas-container.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index 7f95ba1..69140c8 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -6760,8 +6760,10 @@ finish_adding_new_icons (NautilusCanvasContainer *container)
         icon = p->data;
         if (icon->has_lazy_position)
         {
-            assign_icon_position (container, icon);
-            semi_position_icons = g_list_prepend (semi_position_icons, icon);
+            if (!assign_icon_position (container, icon))
+            {
+                semi_position_icons = g_list_prepend (semi_position_icons, icon);
+            }
         }
         else if (!assign_icon_position (container, icon))
         {


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