diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2008-07-01 05:38:49 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-07-01 05:38:49 +0000 |
commit | a7abdcf8fc5a6aabb00830c4c299fe154edbc3fc (patch) | |
tree | e3ca926e1bae0cd7f4e4ef13649b35cb78bd772e /gtk/gtkprintoperation-unix.c | |
parent | cbd06646dd1e5b5a231dbf33999770995decae58 (diff) | |
download | gtk+-a7abdcf8fc5a6aabb00830c4c299fe154edbc3fc.tar.gz |
Handle failure to create temp file by returning NULL.
* gtk/gtkprintoperation-unix.c
(_gtk_print_operation_platform_backend_create_preview_surface):
Handle failure to create temp file by returning NULL.
* gtk/gtkprintoperation.c (gtk_print_operation_preview_handler):
Return FALSE if surface creation fails.
(print_pages): If the preiew signal is not handled, show an
error dialog.
svn path=/trunk/; revision=20715
Diffstat (limited to 'gtk/gtkprintoperation-unix.c')
-rw-r--r-- | gtk/gtkprintoperation-unix.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c index 329361238d..583ec929ce 100644 --- a/gtk/gtkprintoperation-unix.c +++ b/gtk/gtkprintoperation-unix.c @@ -667,6 +667,13 @@ _gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation filename = g_build_filename (g_get_tmp_dir (), "previewXXXXXX.pdf", NULL); fd = g_mkstemp (filename); + + if (fd < 0) + { + g_free (filename); + return NULL; + } + *target = filename; paper_size = gtk_page_setup_get_paper_size (page_setup); @@ -674,7 +681,7 @@ _gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS); *dpi_x = *dpi_y = 72; - surface = cairo_pdf_surface_create_for_stream (write_preview, GINT_TO_POINTER(fd), w, h); + surface = cairo_pdf_surface_create_for_stream (write_preview, GINT_TO_POINTER (fd), w, h); cairo_surface_set_user_data (surface, &key, GINT_TO_POINTER (fd), close_preview); |