From 080c5422a932e01791f44753392e0d18abee0db8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Wilmet?= <swilmet@mailfence.com>
Date: Sat, 31 Aug 2024 17:59:29 +0200
Subject: [PATCH] Completion: fix a potential crash

---
 gtksourceview/gtksourcecompletion.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index ecd829b4a..b3813c92d 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -2028,7 +2028,7 @@ init_tree_view (GtkSourceCompletion *completion,
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *cell_renderer;
 	GtkStyleContext *style_context;
-	GdkRGBA *background_color;
+	GdkRGBA *background_color = NULL;
 	GdkRGBA foreground_color;
 
 	completion->priv->tree_view_proposals = GTK_TREE_VIEW (gtk_builder_get_object (builder, "tree_view_proposals"));
@@ -2147,7 +2147,10 @@ init_tree_view (GtkSourceCompletion *completion,
 				 column,
 				 0);
 
-	gdk_rgba_free (background_color);
+	if (background_color != NULL)
+	{
+		gdk_rgba_free (background_color);
+	}
 }
 
 static void
-- 
GitLab

