summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Ratelle <nratelle@qnx.com>2012-02-17 20:17:52 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-14 01:41:49 (GMT)
commitce52989b3b955c1e91e8449b77ea6aa5e1b4d5f6 (patch)
tree3c6784c9f6d78cf288b707363a1726477a25aca1 /src
parent83c7d19e2a96010724b281bae3410fd764e5d908 (diff)
downloadQt-ce52989b3b955c1e91e8449b77ea6aa5e1b4d5f6.zip
Qt-ce52989b3b955c1e91e8449b77ea6aa5e1b4d5f6.tar.gz
Qt-ce52989b3b955c1e91e8449b77ea6aa5e1b4d5f6.tar.bz2
Fix number of available printers in CUPS support
If available printers in CUPS support. If the number of available printers changes, we want to update the count. Additionally, if that number has gone to zero, we want to ensure that the number of available printers in the static object is reset to zero. This fixes a crash that occurs if: * You print * You kill cupsd (or it crashes because you're porting it and your port is * unstable) * You try to print again before restarting it. cherry-picked from qt5/qtbase eda0e120e9e2e7b7be747f4ed035d686c9547769 Change-Id: If4640045073acaecec4495f5cb01806ae859cf65 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qcups.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/painting/qcups.cpp b/src/gui/painting/qcups.cpp
index 1618924..dd6ec80 100644
--- a/src/gui/painting/qcups.cpp
+++ b/src/gui/painting/qcups.cpp
@@ -133,7 +133,8 @@ QCUPSSupport::QCUPSSupport()
if (!isAvailable())
return;
- prnCount = _cupsGetDests(&printers);
+ // Update the available printer count
+ qt_cups_num_printers = prnCount = _cupsGetDests(&printers);
for (int i = 0; i < prnCount; ++i) {
if (printers[i].is_default) {