[gnome-control-center] user-accounts: 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] user-accounts: Fix a critical warning if loading a cursor fails
- Date: Mon, 2 Nov 2020 21:45:22 +0000 (UTC)
commit 243ff6a5111e4ff7a117b06501167cf5c37e7fb6
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Sep 29 14:58:47 2020 +0100
user-accounts: 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/user-accounts/cc-crop-area.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/panels/user-accounts/cc-crop-area.c b/panels/user-accounts/cc-crop-area.c
index c4a04a630..fc7cb621d 100644
--- a/panels/user-accounts/cc-crop-area.c
+++ b/panels/user-accounts/cc-crop-area.c
@@ -352,10 +352,10 @@ update_cursor (CcCropArea *area,
}
if (cursor_type != area->current_cursor) {
- GdkCursor *cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (area)),
- cursor_type);
+ g_autoptr(GdkCursor) cursor = NULL;
+ cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (area)),
+ cursor_type);
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
- g_object_unref (cursor);
area->current_cursor = cursor_type;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]