gtk+ r20711 - in branches/gtk-2-12: . gtk



Author: matthiasc
Date: Tue Jul  1 05:04:30 2008
New Revision: 20711
URL: http://svn.gnome.org/viewvc/gtk+?rev=20711&view=rev

Log:
        * gtk/gtkprintoperation.c : check surface status after ceating a pdf.
        Avoids crashing when the target can not be written, bug #537685




Modified:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/gtk/gtkprintoperation.c

Modified: branches/gtk-2-12/gtk/gtkprintoperation.c
==============================================================================
--- branches/gtk-2-12/gtk/gtkprintoperation.c	(original)
+++ branches/gtk-2-12/gtk/gtkprintoperation.c	Tue Jul  1 05:04:30 2008
@@ -1839,6 +1839,17 @@
   
   surface = cairo_pdf_surface_create (priv->export_filename,
 				      width, height);
+  if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
+    {
+      g_set_error (&priv->error,
+                   GTK_PRINT_ERROR,
+                   GTK_PRINT_ERROR_GENERAL,
+                   cairo_status_to_string (cairo_surface_status (surface)));
+      *do_print = FALSE;
+      return GTK_PRINT_OPERATION_RESULT_ERROR;
+    }
+
+  /* this would crash on a nil surface */
   cairo_surface_set_fallback_resolution (surface, 300, 300);
 
   priv->platform_data = surface;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]