PKGBUILDs/extra/chromium/chromium-25.0.1364.152-fix-crash-when-cups-is-down.patch

69 lines
2.4 KiB
Diff
Raw Normal View History

2013-03-05 20:40:16 +00:00
From b824ad5ee90704db9942857145f04b8542924b12 Mon Sep 17 00:00:00 2001
From: "noamsml@google.com"
<noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Thu, 28 Feb 2013 19:00:49 +0000
Subject: [PATCH] Fix crash in chrome when trying to print with CUPS down
This is a workaround for GTK bug https://bugzilla.gnome.org/show_bug.cgi?id=686838.
Removed listing of printers when setting up default settings in native print dialog,
as it is not necessary (behavior verified to be unchanged). Added check to ensure
print preview dialog does not try to instantiate a printer list when selecting a
cloud printer, as this is also unnecessary (again, no behavior change).
BUG=160574
Review URL: https://chromiumcodereview.appspot.com/12374003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185284 0039d316-1c4b-4281-b951-d872f2087c98
---
chrome/browser/printing/print_dialog_gtk.cc | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc
index 70fe427..d8cb419 100644
--- a/chrome/browser/printing/print_dialog_gtk.cc
+++ b/chrome/browser/printing/print_dialog_gtk.cc
@@ -130,21 +130,11 @@ PrintDialogGtk::~PrintDialogGtk() {
void PrintDialogGtk::UseDefaultSettings() {
DCHECK(!page_setup_);
+ DCHECK(!printer_);
// |gtk_settings_| is a new object.
gtk_settings_ = gtk_print_settings_new();
-
- scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList);
- printer_ = printer_list->default_printer();
- if (printer_) {
- g_object_ref(printer_);
- gtk_print_settings_set_printer(gtk_settings_,
- gtk_printer_get_name(printer_));
- page_setup_ = gtk_printer_get_default_page_size(printer_);
- }
-
- if (!page_setup_)
- page_setup_ = gtk_page_setup_new();
+ page_setup_ = gtk_page_setup_new();
// No page range to initialize for default settings.
PageRanges ranges_vector;
@@ -173,10 +163,12 @@ bool PrintDialogGtk::UpdateSettings(const base::DictionaryValue& job_settings,
return false;
}
+ bool is_cloud_print = job_settings.HasKey(printing::kSettingCloudPrintId);
+
if (!gtk_settings_)
gtk_settings_ = gtk_print_settings_new();
- if (!print_to_pdf) {
+ if (!print_to_pdf && !is_cloud_print) {
scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList);
printer_ = printer_list->GetPrinterWithName(device_name.c_str());
if (printer_) {
--
1.7.10