Don't pass invalid rectangles to cairo
authorMatthias Clasen <mclasen@redhat.com>
Mon, 16 Mar 2015 16:51:56 +0000 (12:51 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 16 Mar 2015 16:51:56 +0000 (12:51 -0400)
This causes pixman warnings, or worse.
Clearly, something is not quite right here, if we end up
redrawing tabs at a time when the allocation is set to (1, 1).
For now, avoid straining the error handling in the lower layers.

https://bugzilla.gnome.org/show_bug.cgi?id=746301

gtk/gtknotebook.c

index 9f6b51fd7f08acb27b1590cffaab01cdc32b0e76..65cc32e1032e92167da58bc64d86054c53656d11 100644 (file)
@@ -4832,7 +4832,7 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
         page->allocation.height - padding.bottom;
       /* fall through */
     case GTK_POS_TOP:
-      redraw_rect.width = allocation.width - 2 * border;
+      redraw_rect.width = MAX (1, allocation.width - 2 * border);
       redraw_rect.height = page->allocation.height + padding.top;
 
       break;
@@ -4843,7 +4843,7 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
       /* fall through */
     case GTK_POS_LEFT:
       redraw_rect.width = page->allocation.width + padding.left;
-      redraw_rect.height = allocation.height - 2 * border;
+      redraw_rect.height = MAX (1, allocation.height - 2 * border);
 
       break;
     }