You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-qt/qtprintsupport/files/qtprintsupport-5.13.2-no-cu...

50 lines
2.1 KiB

From 2ad3348031d8a622374920eac5bdd8fb9ecefcd7 Mon Sep 17 00:00:00 2001
From: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Date: Sat, 21 Dec 2019 19:57:45 +0100
Subject: QPrintDialog: don't access dangling pointer when cups is disabled
When no cups support is available, ui.pagesRadioButton is destroyed in
QPrintDialogPrivate::init() but was accessed later on. Fix it by moving
the cups check one line above.
Fixes: QTBUG-80945
Change-Id: Ieb062b39e1461f39665ef612dfea1d7757274b7e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
---
src/printsupport/dialogs/qprintdialog_unix.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index c7328d9732..7bbf137977 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -637,8 +637,10 @@ void QPrintDialogPrivate::init()
options.pageSetCombo->addItem(tr("Odd Pages"), QVariant::fromValue(QCUPSSupport::OddPages));
options.pageSetCombo->addItem(tr("Even Pages"), QVariant::fromValue(QCUPSSupport::EvenPages));
#else
- for (int i = options.pagesLayout->count() - 1; i >= 0; --i)
- delete options.pagesLayout->itemAt(i)->widget();
+ delete options.pagesRadioButton;
+ delete options.pagesLineEdit;
+ options.pagesRadioButton = nullptr;
+ options.pagesLineEdit = nullptr;
#endif
top->d->setOptionsPane(this);
@@ -727,12 +729,12 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma
else
options.pageSetCombo->setEnabled(true);
+#if QT_CONFIG(cups)
// Disable complex page ranges widget when printing to pdf
// It doesn't work since it relies on cups to do the heavy lifting and cups
// is not used when printing to PDF
options.pagesRadioButton->setEnabled(outputFormat != QPrinter::PdfFormat);
-#if QT_CONFIG(cups)
// Disable color options on main dialog if not printing to file, it will be handled by CUPS advanced dialog
options.colorMode->setVisible(outputFormat == QPrinter::PdfFormat);
#endif
--
cgit v1.2.1