r32525 - in /desktop/unstable/gtk+2.0/debian: changelog patches/070-dont-crash-when-printing.patch patches/series

biebl at users.alioth.debian.org biebl at users.alioth.debian.org
Mon Feb 6 12:23:30 UTC 2012


Author: biebl
Date: Mon Feb  6 12:23:29 2012
New Revision: 32525

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=32525
Log:
* debian/patches/070-dont-crash-when-printing.patch:
  - Fix crash due to incorrect handling of custom CUPS options. Patch
    cherry-picked from upstream Git. Closes: #658710

Added:
    desktop/unstable/gtk+2.0/debian/patches/070-dont-crash-when-printing.patch
Modified:
    desktop/unstable/gtk+2.0/debian/changelog
    desktop/unstable/gtk+2.0/debian/patches/series

Modified: desktop/unstable/gtk+2.0/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gtk%2B2.0/debian/changelog?rev=32525&op=diff
==============================================================================
--- desktop/unstable/gtk+2.0/debian/changelog [utf-8] (original)
+++ desktop/unstable/gtk+2.0/debian/changelog [utf-8] Mon Feb  6 12:23:29 2012
@@ -1,3 +1,11 @@
+gtk+2.0 (2.24.9-2) UNRELEASED; urgency=low
+
+  * debian/patches/070-dont-crash-when-printing.patch:
+    - Fix crash due to incorrect handling of custom CUPS options. Patch
+      cherry-picked from upstream Git. Closes: #658710
+
+ -- Michael Biebl <biebl at debian.org>  Mon, 06 Feb 2012 13:22:03 +0100
+
 gtk+2.0 (2.24.9-1) unstable; urgency=low
 
   * New upstream release.

Added: desktop/unstable/gtk+2.0/debian/patches/070-dont-crash-when-printing.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gtk%2B2.0/debian/patches/070-dont-crash-when-printing.patch?rev=32525&op=file
==============================================================================
--- desktop/unstable/gtk+2.0/debian/patches/070-dont-crash-when-printing.patch (added)
+++ desktop/unstable/gtk+2.0/debian/patches/070-dont-crash-when-printing.patch [utf-8] Mon Feb  6 12:23:29 2012
@@ -1,0 +1,135 @@
+From 66c99016d3d063aee0e00793da8f087c80172012 Mon Sep 17 00:00:00 2001
+From: Marek Kasik <mkasik at redhat.com>
+Date: Tue, 31 Jan 2012 11:01:43 +0000
+Subject: printing: Don't crash when printing
+
+This commit fixes crash which occurs in Firefox, Thunderbird and Inkscape
+during printing. This crash was caused because of wrong handling of Custom
+CUPS options. (#543520)
+---
+diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
+index 138bddd..59914ba 100644
+--- a/modules/printbackends/cups/gtkprintbackendcups.c
++++ b/modules/printbackends/cups/gtkprintbackendcups.c
+@@ -485,7 +485,7 @@ cups_print_cb (GtkPrintBackendCups *print_backend,
+ 
+ typedef struct {
+   GtkCupsRequest *request;
+-  GtkPrinterOptionSet *options;
++  GtkPrinterCups *printer;
+ } CupsOptionsData;
+ 
+ static void
+@@ -495,9 +495,13 @@ add_cups_options (const gchar *key,
+ {
+   CupsOptionsData *data = (CupsOptionsData *) user_data;
+   GtkCupsRequest *request = data->request;
+-  GtkPrinterOptionSet *options = data->options;
+-  GtkPrinterOption *option = NULL;
++  GtkPrinterCups *printer = data->printer;
++  gboolean custom_value = FALSE;
+   gchar *new_value = NULL;
++  gint i;
++
++  if (!key || !value)
++    return;
+ 
+   if (!g_str_has_prefix (key, "cups-"))
+     return;
+@@ -505,17 +509,37 @@ add_cups_options (const gchar *key,
+   if (strcmp (value, "gtk-ignore-value") == 0)
+     return;
+ 
+-  option = gtk_printer_option_set_lookup (options, key);
+-  
+   key = key + strlen ("cups-");
+ 
+-  /* Add "Custom." prefix to custom values */
+-  if (value && option &&
+-      !gtk_printer_option_has_choice (option, value))
+-    new_value = g_strdup_printf ("Custom.%s", value);
++  if (printer && printer->ppd_file)
++    {
++      ppd_coption_t *coption;
++      gboolean       found = FALSE;
++      gboolean       custom_values_enabled = FALSE;
++
++      coption = ppdFindCustomOption (printer->ppd_file, key);
++      if (coption && coption->option)
++        {
++          for (i = 0; i < coption->option->num_choices; i++)
++            {
++              /* Are custom values enabled ? */
++              if (g_str_equal (coption->option->choices[i].choice, "Custom"))
++                custom_values_enabled = TRUE;
++
++              /* Is the value among available choices ? */
++              if (g_str_equal (coption->option->choices[i].choice, value))
++                found = TRUE;
++            }
+ 
+-  if (new_value)
++          if (custom_values_enabled && !found)
++            custom_value = TRUE;
++        }
++    }
++
++  /* Add "Custom." prefix to custom values. */
++  if (custom_value)
+     {
++      new_value = g_strdup_printf ("Custom.%s", value);
+       gtk_cups_request_encode_option (request, key, new_value);
+       g_free (new_value);
+     }
+@@ -536,9 +560,6 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend         *print_backend,
+   CupsOptionsData *options_data;
+   GtkCupsRequest *request;
+   GtkPrintSettings *settings;
+-  GtkPrinterOptionSet *options;
+-  GtkPrintCapabilities capabilities;
+-  GtkPageSetup *page_setup;
+   const gchar *title;
+   char  printer_absolute_uri[HTTP_MAX_URI];
+ 
+@@ -547,8 +568,6 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend         *print_backend,
+ 
+   cups_printer = GTK_PRINTER_CUPS (gtk_print_job_get_printer (job));
+   settings = gtk_print_job_get_settings (job);
+-  capabilities = cups_printer_get_capabilities (GTK_PRINTER (cups_printer));
+-  page_setup = gtk_printer_get_default_page_size (GTK_PRINTER (cups_printer));
+ 
+   request = gtk_cups_request_new_with_username (NULL,
+                                                 GTK_CUPS_POST,
+@@ -586,16 +605,10 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend         *print_backend,
+                                      IPP_TAG_NAME, "job-name", 
+                                      NULL, title);
+ 
+-  options = cups_printer_get_options (GTK_PRINTER (cups_printer), settings, page_setup, capabilities);
+-
+   options_data = g_new0 (CupsOptionsData, 1);
+   options_data->request = request;
+-  options_data->options = options;
+-
++  options_data->printer = cups_printer;
+   gtk_print_settings_foreach (settings, add_cups_options, options_data);
+-
+-  g_object_unref (page_setup);
+-  g_object_unref (options);
+   g_free (options_data);
+ 
+   ps = g_new0 (CupsPrintStreamData, 1);
+@@ -4606,7 +4619,12 @@ cups_printer_get_default_page_size (GtkPrinter *printer)
+     return NULL;
+ 
+   option = ppdFindOption (ppd_file, "PageSize");
++  if (option == NULL)
++    return NULL;
++
+   size = ppdPageSize (ppd_file, option->defchoice); 
++  if (size == NULL)
++    return NULL;
+ 
+   return create_page_setup (ppd_file, size);
+ }
+--
+cgit v0.9.0.2

Modified: desktop/unstable/gtk+2.0/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gtk%2B2.0/debian/patches/series?rev=32525&op=diff
==============================================================================
--- desktop/unstable/gtk+2.0/debian/patches/series [utf-8] (original)
+++ desktop/unstable/gtk+2.0/debian/patches/series [utf-8] Mon Feb  6 12:23:29 2012
@@ -12,4 +12,5 @@
 060_ignore-random-icons.patch
 061_use_pdf_as_default_printing_standard.patch
 065_gir_set_packages.patch
+070-dont-crash-when-printing.patch
 098_multiarch_module_path.patch




More information about the pkg-gnome-commits mailing list