widget: Don't call snapshot vfunc if width or height are 0
authorTimm Bäder <mail@baedert.org>
Fri, 2 Feb 2018 13:50:17 +0000 (14:50 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 3 Feb 2018 11:22:52 +0000 (12:22 +0100)
The result won't be visible anyway. This also prevents problems with
widgets that create some resource the size of the widget, like
GtkGLArea. It also keeps us from snapshotting revealers with
size 0.

gtk/gtkwidget.c

index d67c7a9e2f97f61c5f246818251766b5f6b6ba61..99767064af7188067a778a7301671f4a21128f7e 100644 (file)
@@ -14165,7 +14165,8 @@ gtk_widget_snapshot (GtkWidget   *widget,
 
       /* Offset to content allocation */
       gtk_snapshot_offset (snapshot, margin.left + padding.left + border.left, margin.top + border.top + padding.top);
-      klass->snapshot (widget, snapshot);
+      if (gtk_widget_get_width (widget) > 0 || gtk_widget_get_height (widget) > 0)
+        klass->snapshot (widget, snapshot);
       gtk_snapshot_offset (snapshot, - (margin.left + padding.left + border.left), -(margin.top + border.top + padding.top));
 
       if (g_signal_has_handler_pending (widget, widget_signals[DRAW], 0, FALSE))