• Daniel Boles's avatar
    Container: Don’t scroll to unset focus child coord · cf955a54
    Daniel Boles authored
    In gtk_container_real_set_focus_child(), we try to scroll to the
    position of the new :focus-child if we have h or v adjustments.
    
    gtk_widget_translate_coordinates() returns FALSE if neither widget is
    realized or in other situations that cause output parameters x and y not
    to be set. Thus, if the caller did not initialise x/y and uses them even
    if the function returns FALSE, they are using uninitialised variables.
    
    In gtk_container_real_set_focus_child(), we did not check the return
    value but merrily went ahead and used x and y regardless. This is UB, as
    caught by Valgrind, as well as being pointless.
    
    The trivial fix is to exit early if (!gtk_widget_translate_coordinates).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776909
    cf955a54