[gedit] Fix critical messages with NULL cursor



commit 741c22c603df1b1ab7c7314f522b6999ccea3cc2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Nov 6 10:42:40 2015 +0100

    Fix critical messages with NULL cursor
    
    gdk_cursor_new_from_name() can return NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757639

 gedit/gedit-tab.c                               |    4 ++--
 plugins/filebrowser/gedit-file-browser-widget.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 3eeaa68..c80b34d 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -467,7 +467,7 @@ set_cursor_according_to_state (GtkTextView   *view,
                if (left_window != NULL)
                        gdk_window_set_cursor (left_window, cursor);
 
-               g_object_unref (cursor);
+               g_clear_object (&cursor);
        }
        else
        {
@@ -478,7 +478,7 @@ set_cursor_according_to_state (GtkTextView   *view,
                if (left_window != NULL)
                        gdk_window_set_cursor (left_window, NULL);
 
-               g_object_unref (cursor);
+               g_clear_object (&cursor);
        }
 }
 
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index fe38395..add69fd 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -1954,7 +1954,6 @@ static void
 set_busy (GeditFileBrowserWidget *obj,
          gboolean                busy)
 {
-       GdkCursor *cursor;
        GdkWindow *window;
 
        window = gtk_widget_get_window (GTK_WIDGET (obj->priv->treeview));
@@ -1965,11 +1964,12 @@ set_busy (GeditFileBrowserWidget *obj,
        if (busy)
        {
                GdkDisplay *display;
+               GdkCursor *cursor;
 
                display = gtk_widget_get_display (GTK_WIDGET (obj));
                cursor = gdk_cursor_new_from_name (display, "progress");
                gdk_window_set_cursor (window, cursor);
-               g_object_unref (cursor);
+               g_clear_object (&cursor);
        }
        else
        {


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