[shotwell] Don't crash when cursor goes away due to removed photo: Bug #732334



commit d4420d65d843a4e6cf63ecfc00724735fc70f309
Author: Daniel Landau <daniel landau iki fi>
Date:   Mon Jun 30 14:23:49 2014 -0700

    Don't crash when cursor goes away due to removed photo: Bug #732334
    
    When a photo is removed from a collection (moved to another collection
    or removed outright), the view's cursor may go away with it.  Add some
    code to check for cursor's presence before using it.

 src/CheckerboardLayout.vala |    5 ++++-
 src/Page.vala               |    4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/CheckerboardLayout.vala b/src/CheckerboardLayout.vala
index a542462..6d0ce61 100644
--- a/src/CheckerboardLayout.vala
+++ b/src/CheckerboardLayout.vala
@@ -989,7 +989,10 @@ public class CheckerboardLayout : Gtk.DrawingArea {
         Gee.HashSet<DataView> collection = new Gee.HashSet<DataView>();
         if (cursor != null) {
             cursor.set_is_cursor(false);
-            collection.add(cursor);
+            // Bug #732334, the cursor DataView might have disappeared when user drags a full screen Photo 
to another event
+            if (view.contains(cursor)) {
+                collection.add(cursor);
+            }
         }
         item.set_is_cursor(true);
         cursor = item;
diff --git a/src/Page.vala b/src/Page.vala
index 1eecacf..807a926 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -1815,7 +1815,9 @@ public abstract class CheckerboardPage : Page {
             return;
             
         // if there is no better starting point, simply select the first and exit
-        if (cursor == null && layout.get_cursor() == null) {
+        // The right half of the or is related to Bug #732334, the cursor might be non-null and still not 
contained in
+        // the view, if the user dragged a full screen Photo off screen
+        if (cursor == null && layout.get_cursor() == null || cursor != null && !get_view().contains(cursor)) 
{
             CheckerboardItem item = layout.get_item_at_coordinate(0, 0);
             cursor_to_item(item);
             anchor = item;


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