gtk+ r20370 - in trunk: . gdk/win32 gtk



Author: hans
Date: Fri Jun 13 08:36:26 2008
New Revision: 20370
URL: http://svn.gnome.org/viewvc/gtk+?rev=20370&view=rev

Log:
2008-05-23  Hans Breuer  <hans breuer org>

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

	* gdk/win32/gdkdisplay-win32.c : runtime linking of ProcessIdToSessionId

	* gtk/gtkfilesystem.c : variadic macros are not supported with c89 and
	it was not needed here anyway.



Modified:
   trunk/ChangeLog
   trunk/gdk/win32/gdkdisplay-win32.c
   trunk/gtk/gtkfilesystem.c
   trunk/gtk/gtkprintoperation.c

Modified: trunk/gdk/win32/gdkdisplay-win32.c
==============================================================================
--- trunk/gdk/win32/gdkdisplay-win32.c	(original)
+++ trunk/gdk/win32/gdkdisplay-win32.c	Fri Jun 13 08:36:26 2008
@@ -241,6 +241,8 @@
   DWORD session_id;
   char *display_name;
   static const char *display_name_cache = NULL;
+  typedef BOOL (* PFN_ProcessIdToSessionId) (DWORD, DWORD *);
+  PFN_ProcessIdToSessionId processIdToSessionId;
 
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
   
@@ -275,7 +277,8 @@
 	window_station_name = "WinSta0";
     }
 
-  if (!ProcessIdToSessionId (GetCurrentProcessId (), &session_id))
+  processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
+  if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
     session_id = 0;
 
   display_name = g_strdup_printf ("%ld\\%s\\%s",

Modified: trunk/gtk/gtkfilesystem.c
==============================================================================
--- trunk/gtk/gtkfilesystem.c	(original)
+++ trunk/gtk/gtkfilesystem.c	Fri Jun 13 08:36:26 2008
@@ -29,9 +29,9 @@
 
 /* #define DEBUG_MODE */
 #ifdef DEBUG_MODE
-#define DEBUG(x...) g_debug (x);
+#define DEBUG(x) g_debug (x);
 #else
-#define DEBUG(x...)
+#define DEBUG(x)
 #endif
 
 #define GTK_FILE_SYSTEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_FILE_SYSTEM, GtkFileSystemPrivate))

Modified: trunk/gtk/gtkprintoperation.c
==============================================================================
--- trunk/gtk/gtkprintoperation.c	(original)
+++ trunk/gtk/gtkprintoperation.c	Fri Jun 13 08:36:26 2008
@@ -1840,6 +1840,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]