[gtk+/gtk-2-24] Bug 729924 - Crash trying to print in OSX
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Bug 729924 - Crash trying to print in OSX
- Date: Sun, 3 Aug 2014 09:53:53 +0000 (UTC)
commit 825e0358336f3d0eea64b6a42343a529d19d5f8c
Author: John Ralls <jralls ceridwen us>
Date: Sun May 25 16:58:16 2014 -0700
Bug 729924 - Crash trying to print in OSX
modules/printbackends/cups/gtkprintbackendcups.c | 44 +++++++++++++---------
1 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c
b/modules/printbackends/cups/gtkprintbackendcups.c
index 4efeb72..cebdc17 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -4839,25 +4839,33 @@ cups_printer_get_options (GtkPrinter *printer,
paper_size = gtk_page_setup_get_paper_size (page_setup);
option = ppdFindOption (ppd_file, "PageSize");
- ppd_name = gtk_paper_size_get_ppd_name (paper_size);
-
- if (ppd_name)
- strncpy (option->defchoice, ppd_name, PPD_MAX_NAME);
- else
+ if (option)
{
- gchar *custom_name;
- char width[G_ASCII_DTOSTR_BUF_SIZE];
- char height[G_ASCII_DTOSTR_BUF_SIZE];
-
- g_ascii_formatd (width, sizeof (width), "%.2f", gtk_paper_size_get_width (paper_size,
GTK_UNIT_POINTS));
- g_ascii_formatd (height, sizeof (height), "%.2f", gtk_paper_size_get_height (paper_size,
GTK_UNIT_POINTS));
- /* Translators: this format is used to display a custom paper
- * size. The two placeholders are replaced with the width and height
- * in points. E.g: "Custom 230.4x142.9"
- */
- custom_name = g_strdup_printf (_("Custom %sx%s"), width, height);
- strncpy (option->defchoice, custom_name, PPD_MAX_NAME);
- g_free (custom_name);
+ ppd_name = gtk_paper_size_get_ppd_name (paper_size);
+
+ if (ppd_name)
+ strncpy (option->defchoice, ppd_name, PPD_MAX_NAME);
+ else
+ {
+ gchar *custom_name;
+ char width[G_ASCII_DTOSTR_BUF_SIZE];
+ char height[G_ASCII_DTOSTR_BUF_SIZE];
+
+ g_ascii_formatd (width, sizeof (width), "%.2f",
+ gtk_paper_size_get_width (paper_size,
+ GTK_UNIT_POINTS));
+ g_ascii_formatd (height, sizeof (height), "%.2f",
+ gtk_paper_size_get_height (paper_size,
+ GTK_UNIT_POINTS));
+ /* Translators: this format is used to display a custom
+ * paper size. The two placeholders are replaced with
+ * the width and height in points. E.g: "Custom
+ * 230.4x142.9"
+ */
+ custom_name = g_strdup_printf (_("Custom %sx%s"), width, height);
+ strncpy (option->defchoice, custom_name, PPD_MAX_NAME);
+ g_free (custom_name);
+ }
}
for (i = 0; i < ppd_file->num_groups; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]