[gnome-control-center/gnome-3-36] wacom: Fix a critical warning if loading a cursor fails
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-36] wacom: Fix a critical warning if loading a cursor fails
- Date: Fri, 20 Nov 2020 00:57:40 +0000 (UTC)
commit aeaa6440a1deb81266bd04de3aa34700120f5d6e
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Sep 29 14:59:42 2020 +0100
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>
panels/wacom/calibrator/calibrator-gui.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/panels/wacom/calibrator/calibrator-gui.c b/panels/wacom/calibrator/calibrator-gui.c
index caff030c8..012291f8b 100644
--- a/panels/wacom/calibrator/calibrator-gui.c
+++ b/panels/wacom/calibrator/calibrator-gui.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]