[nautilus/wip/ernestask/leak-plugging: 9/10] window: Use auto pointer for cursor



commit faec8c47bc702d8e8419556b2359ae2bf5a110aa
Author: Ernestas Kulik <ernestask gnome org>
Date:   Sat Oct 6 20:44:45 2018 +0300

    window: Use auto pointer for cursor
    
    If, for some reason, the cursor is null, we end up with a critical when
    unreffing. Not very good when running tests.

 src/nautilus-window.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 9b3380de6..4f7407774 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -773,7 +773,6 @@ static void
 update_cursor (NautilusWindow *window)
 {
     NautilusWindowSlot *slot;
-    GdkCursor *cursor;
 
     slot = nautilus_window_get_active_slot (window);
 
@@ -781,11 +780,11 @@ update_cursor (NautilusWindow *window)
         nautilus_window_slot_get_allow_stop (slot))
     {
         GdkDisplay *display;
+        g_autoptr (GdkCursor) cursor = NULL;
 
         display = gtk_widget_get_display (GTK_WIDGET (window));
         cursor = gdk_cursor_new_from_name (display, "progress");
         gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
-        g_object_unref (cursor);
     }
     else
     {


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