summaryrefslogtreecommitdiff
path: root/gtk/gtkwidgetfocus.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2019-02-20 04:53:47 +0100
committerBenjamin Otte <otte@redhat.com>2019-02-20 05:26:31 +0100
commit01f7f255b5a2bb6407825c0f5dc05ecfe5cffe88 (patch)
treeaca81a7d0a5d37121fbbedd44ed05198f2b0d637 /gtk/gtkwidgetfocus.c
parent514c3679dc7647db1e64734dab3afc9c9e761e72 (diff)
downloadgtk+-01f7f255b5a2bb6407825c0f5dc05ecfe5cffe88.tar.gz
gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS transforms with them, but hey...
Diffstat (limited to 'gtk/gtkwidgetfocus.c')
-rw-r--r--gtk/gtkwidgetfocus.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gtk/gtkwidgetfocus.c b/gtk/gtkwidgetfocus.c
index 79177311d4..af68bd7a56 100644
--- a/gtk/gtkwidgetfocus.c
+++ b/gtk/gtkwidgetfocus.c
@@ -80,8 +80,9 @@ tab_sort_func (gconstpointer a,
GtkTextDirection text_direction = GPOINTER_TO_INT (user_data);
float y1, y2;
- gtk_widget_compute_bounds (child1, gtk_widget_get_parent (child1), &child_bounds1);
- gtk_widget_compute_bounds (child2, gtk_widget_get_parent (child2), &child_bounds2);
+ if (!gtk_widget_compute_bounds (child1, gtk_widget_get_parent (child1), &child_bounds1) ||
+ !gtk_widget_compute_bounds (child2, gtk_widget_get_parent (child2), &child_bounds2))
+ return 0;
y1 = child_bounds1.origin.y + (child_bounds1.size.height / 2.0f);
y2 = child_bounds2.origin.y + (child_bounds2.size.height / 2.0f);
@@ -178,8 +179,9 @@ axis_compare (gconstpointer a,
int start1, end1;
int start2, end2;
- gtk_widget_compute_bounds (*((GtkWidget **)a), compare->widget, &bounds1);
- gtk_widget_compute_bounds (*((GtkWidget **)b), compare->widget, &bounds2);
+ if (!gtk_widget_compute_bounds (*((GtkWidget **)a), compare->widget, &bounds1) ||
+ !gtk_widget_compute_bounds (*((GtkWidget **)b), compare->widget, &bounds2))
+ return 0;
get_axis_info (&bounds1, compare->axis, &start1, &end1);
get_axis_info (&bounds2, compare->axis, &start2, &end2);
@@ -278,7 +280,8 @@ focus_sort_left_right (GtkWidget *widget,
graphene_rect_t old_focus_bounds;
parent = gtk_widget_get_parent (widget);
- gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds);
+ if (!gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds))
+ graphene_rect_init (&bounds, 0, 0, 0, 0);
if (old_focus_coords (widget, &old_focus_bounds))
{
@@ -379,7 +382,8 @@ focus_sort_up_down (GtkWidget *widget,
graphene_rect_t old_focus_bounds;
parent = gtk_widget_get_parent (widget);
- gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds);
+ if (!gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds))
+ graphene_rect_init (&bounds, 0, 0, 0, 0);
if (old_focus_coords (widget, &old_focus_bounds))
{