From 9eac7ed8b9851a8bebc94f16ff65bee0d3c35ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 3 Feb 2023 16:41:56 +0100 Subject: [PATCH] gtktextview: Avoid calling gdk_rgba_free for NULL values Related to glib#2908 --- gtk/gtktextview.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 62043ad54b..fe7a63b69e 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -7787,8 +7787,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view, else { values->appearance.underline = PANGO_UNDERLINE_NONE; - gdk_rgba_free (values->appearance.underline_rgba); - values->appearance.underline_rgba = NULL; + g_clear_pointer (&values->appearance.underline_rgba, gdk_rgba_free); } if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE) @@ -7802,8 +7801,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view, else { values->appearance.overline = PANGO_OVERLINE_NONE; - gdk_rgba_free (values->appearance.overline_rgba); - values->appearance.overline_rgba = NULL; + g_clear_pointer (&values->appearance.overline_rgba, gdk_rgba_free); } if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH) @@ -7817,8 +7815,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view, else { values->appearance.strikethrough = FALSE; - gdk_rgba_free (values->appearance.strikethrough_rgba); - values->appearance.strikethrough_rgba = NULL; + g_clear_pointer (&values->appearance.strikethrough_rgba, gdk_rgba_free); } /* letter-spacing */