From ce52989b3b955c1e91e8449b77ea6aa5e1b4d5f6 Mon Sep 17 00:00:00 2001 From: Nick Ratelle Date: Fri, 17 Feb 2012 15:17:52 -0500 Subject: 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 --- src/gui/painting/qcups.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- cgit v0.12