From 00bb439f6e7c0d7b5c5422dc71b3037ace430967 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 29 Jan 2020 17:36:36 +0000 Subject: [PATCH] malcontent-control: Fix use of an uninitialised variable in the carousel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `dest_x` is not set if `gtk_widget_translate_coordinates()` fails, which it can do before the widget is realised. This fixes a valgrind warning, but doesn’t change any user-visible behaviour as far as I can tell. This has been upstreamed to gnome-control-center as https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/691. Signed-off-by: Philip Withnall --- malcontent-control/carousel.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/malcontent-control/carousel.c b/malcontent-control/carousel.c index 2a10ee4..c69fc9f 100644 --- a/malcontent-control/carousel.c +++ b/malcontent-control/carousel.c @@ -97,12 +97,13 @@ mct_carousel_item_get_x (MctCarouselItem *item, widget = GTK_WIDGET (item); width = gtk_widget_get_allocated_width (widget); - gtk_widget_translate_coordinates (widget, - parent, - width / 2, - 0, - &dest_x, - NULL); + if (!gtk_widget_translate_coordinates (widget, + parent, + width / 2, + 0, + &dest_x, + NULL)) + return 0; return CLAMP (dest_x - ARROW_SIZE, 0,