[nautilus] desktop-canvas-view: fix crash on refresh



commit 0cab9f03ebb7cf7d55c9fb48277b7233d2949443
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Mon Feb 27 17:49:35 2017 +0200

    desktop-canvas-view: fix crash on refresh
    
    Refreshing the desktop makes nautilus-desktop crash.
    
    The cause of this crash is that the desktop canvas view is a floating
    reference. In commit 5c414bfcd181375c5defd7f13b00d422f5384b9e the creation
    of the desktop view was changed and it was forgotten to sink the floating
    ref.
    
    To fix this, remove the floating reference. The reason why the ref sink
    is needed here, as well as in all the other views, is because the views
    are also managed as data structures.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779321

 nautilus-desktop/nautilus-desktop-canvas-view.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/nautilus-desktop/nautilus-desktop-canvas-view.c b/nautilus-desktop/nautilus-desktop-canvas-view.c
index 772c859..16a285f 100644
--- a/nautilus-desktop/nautilus-desktop-canvas-view.c
+++ b/nautilus-desktop/nautilus-desktop-canvas-view.c
@@ -774,7 +774,9 @@ nautilus_desktop_canvas_view_init (NautilusDesktopCanvasView *desktop_canvas_vie
 NautilusFilesView *
 nautilus_desktop_canvas_view_new (NautilusWindowSlot *slot)
 {
-    return g_object_new (NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW,
+    NautilusFilesView *view;
+
+    view = g_object_new (NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW,
                          "window-slot", slot,
                          "supports-zooming", FALSE,
                          "supports-auto-layout", FALSE,
@@ -782,4 +784,11 @@ nautilus_desktop_canvas_view_new (NautilusWindowSlot *slot)
                          "supports-scaling", TRUE,
                          "supports-keep-aligned", TRUE,
                          NULL);
+
+    if (g_object_is_floating (view))
+    {
+        g_object_ref_sink (view);
+    }
+
+    return view;
 }


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