wacom: Fix a critical warning if loading a cursor fails

It’s possible for `gdk_cursor_new_for_display()` to return `NULL`. It’s
OK to pass `NULL` to `gdk_window_set_cursor()`, but not OK to then unref
it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2020-09-29 14:59:42 +01:00 committed by Robert Ancell
parent 243ff6a511
commit e522e5e732

View file

@ -309,7 +309,7 @@ calib_area_new (GdkScreen *screen,
GdkMonitor *monitor;
#ifndef FAKE_AREA
GdkWindow *window;
GdkCursor *cursor;
g_autoptr(GdkCursor) cursor = NULL;
#endif /* FAKE_AREA */
GtkGesture *press;
@ -344,7 +344,6 @@ calib_area_new (GdkScreen *screen,
window = gtk_widget_get_window (calib_area->window);
cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_BLANK_CURSOR);
gdk_window_set_cursor (window, cursor);
g_object_unref (cursor);
gtk_widget_set_can_focus (calib_area->window, TRUE);
gtk_window_set_keep_above (GTK_WINDOW (calib_area->window), TRUE);