Commit 8677ed95 authored by Hans Breuer's avatar Hans Breuer Committed by Hans Breuer

check surface status after ceating a pdf. Avoids crashing when the target

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.


svn path=/trunk/; revision=20370
parent e0c1ab3f
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.
2008-06-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_frame): Fix frame size allocation.
......
......@@ -241,6 +241,8 @@ gdk_display_get_name (GdkDisplay *display)
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 @@ gdk_display_get_name (GdkDisplay *display)
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",
......
......@@ -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))
......
......@@ -1840,6 +1840,17 @@ run_pdf (GtkPrintOperation *op,
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment