summaryrefslogtreecommitdiff
path: root/gtk/gtkgesturestylus.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/gtkgesturestylus.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/gtkgesturestylus.c')
-rw-r--r--gtk/gtkgesturestylus.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gtk/gtkgesturestylus.c b/gtk/gtkgesturestylus.c
index 4c9d704f6d..2122f08e09 100644
--- a/gtk/gtkgesturestylus.c
+++ b/gtk/gtkgesturestylus.c
@@ -284,13 +284,19 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
g_array_append_val (backlog_array, *time_coord);
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
- gtk_widget_compute_point (gtk_get_event_widget (event),
- gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
- &GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
- time_coord->axes[GDK_AXIS_Y]),
- &p);
- time_coord->axes[GDK_AXIS_X] = p.x;
- time_coord->axes[GDK_AXIS_Y] = p.y;
+ if (gtk_widget_compute_point (gtk_get_event_widget (event),
+ gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
+ &GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
+ time_coord->axes[GDK_AXIS_Y]),
+ &p))
+ {
+ time_coord->axes[GDK_AXIS_X] = p.x;
+ time_coord->axes[GDK_AXIS_Y] = p.y;
+ }
+ else
+ {
+ g_array_set_size (backlog_array, backlog_array->len - 1);
+ }
}
*n_elems = backlog_array->len;