[Spice-devel] [PATCH spice-gtk 15/25] Don't attempt to draw an invalid area

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jul 12 15:29:12 PDT 2012


If we don't intersect, the area is invalid or of size 0.
---
 gtk/spice-widget.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 0ab00fe..6b4ae96 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -878,7 +878,8 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
     g_return_val_if_fail(d != NULL, false);
 
-    if (d->mark == 0 || d->data == NULL)
+    if (d->mark == 0 || d->data == NULL ||
+        d->area.width == 0 || d->area.height == 0)
         return false;
     g_return_val_if_fail(d->ximage != NULL, false);
 
@@ -894,7 +895,8 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
     g_return_val_if_fail(d != NULL, false);
 
-    if (d->mark == 0 || d->data == NULL)
+    if (d->mark == 0 || d->data == NULL ||
+        d->area.width == 0 || d->area.height == 0)
         return false;
     g_return_val_if_fail(d->ximage != NULL, false);
 
-- 
1.7.10.4



More information about the Spice-devel mailing list