diff options
author | Benjamin Otte <otte@redhat.com> | 2019-02-20 04:53:47 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2019-02-20 05:26:31 +0100 |
commit | 01f7f255b5a2bb6407825c0f5dc05ecfe5cffe88 (patch) | |
tree | aca81a7d0a5d37121fbbedd44ed05198f2b0d637 /gtk/gtkwidgetpaintable.c | |
parent | 514c3679dc7647db1e64734dab3afc9c9e761e72 (diff) | |
download | gtk+-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/gtkwidgetpaintable.c')
-rw-r--r-- | gtk/gtkwidgetpaintable.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gtk/gtkwidgetpaintable.c b/gtk/gtkwidgetpaintable.c index 531b1332fc..23a359d204 100644 --- a/gtk/gtkwidgetpaintable.c +++ b/gtk/gtkwidgetpaintable.c @@ -96,11 +96,17 @@ gtk_widget_paintable_paintable_snapshot (GdkPaintable *paintable, gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT(0, 0, width, height)); - gtk_widget_compute_bounds (self->widget, self->widget, &bounds); - graphene_matrix_init_from_2d (&transform, - width / bounds.size.width, 0.0, - 0.0, height / bounds.size.height, - bounds.origin.x, bounds.origin.y); + if (gtk_widget_compute_bounds (self->widget, self->widget, &bounds)) + { + graphene_matrix_init_from_2d (&transform, + width / bounds.size.width, 0.0, + 0.0, height / bounds.size.height, + bounds.origin.x, bounds.origin.y); + } + else + { + graphene_matrix_init_identity (&transform); + } gtk_snapshot_push_transform (snapshot, &transform); gtk_widget_snapshot (self->widget, snapshot); @@ -269,7 +275,8 @@ gtk_widget_paintable_snapshot_widget (GtkWidgetPaintable *self) if (self->widget == NULL) return gdk_paintable_new_empty (0, 0); - gtk_widget_compute_bounds (self->widget, self->widget, &bounds); + if (!gtk_widget_compute_bounds (self->widget, self->widget, &bounds)) + return gdk_paintable_new_empty (0, 0); if (self->widget->priv->render_node == NULL) return gdk_paintable_new_empty (bounds.size.width, bounds.size.height); |