malcontent-control: 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. 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 <withnall@endlessm.com>
This commit is contained in:
parent
2ab9924d8d
commit
00bb439f6e
|
@ -97,12 +97,13 @@ mct_carousel_item_get_x (MctCarouselItem *item,
|
||||||
widget = GTK_WIDGET (item);
|
widget = GTK_WIDGET (item);
|
||||||
|
|
||||||
width = gtk_widget_get_allocated_width (widget);
|
width = gtk_widget_get_allocated_width (widget);
|
||||||
gtk_widget_translate_coordinates (widget,
|
if (!gtk_widget_translate_coordinates (widget,
|
||||||
parent,
|
parent,
|
||||||
width / 2,
|
width / 2,
|
||||||
0,
|
0,
|
||||||
&dest_x,
|
&dest_x,
|
||||||
NULL);
|
NULL))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return CLAMP (dest_x - ARROW_SIZE,
|
return CLAMP (dest_x - ARROW_SIZE,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue