[gnome-control-center/gnome-3-34] user-accounts: Fix use of an uninitialised variable in the carousel



commit dcec7599693590feeb018f5d75a0380016ec5d47
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Jan 29 17:43:24 2020 +0000

    user-accounts: Fix use of an uninitialised variable in the carousel
    
    `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.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 panels/user-accounts/cc-carousel.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/panels/user-accounts/cc-carousel.c b/panels/user-accounts/cc-carousel.c
index 139d86e4e..520203f8f 100644
--- a/panels/user-accounts/cc-carousel.c
+++ b/panels/user-accounts/cc-carousel.c
@@ -93,12 +93,13 @@ cc_carousel_item_get_x (CcCarouselItem *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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]