Bläddra i källkod

fix temporary PDF files not being removed when writing to stdout

This is now simpler since 71657b9e41d60fbe03886508e12ad84de2be35bc,
as removeAll() just has to be called at the right places.

fixes #1981
Ashish Kulkarni 10 år sedan
förälder
incheckning
d1339ec848
2 ändrade filer med 5 tillägg och 0 borttagningar
  1. 1 0
      CHANGELOG.md
  2. 4 0
      src/lib/pdfconverter.cc

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ v0.12.3 (unreleased)
 * update OpenSSL to 1.0.2c and xz to 5.2.1
 * update OpenSSL to 1.0.2c and xz to 5.2.1
 * downgrade libpng to 1.2.53
 * downgrade libpng to 1.2.53
 * **#1843**: add --keep-relative-links and --resolve-relative-links to resolve relative links
 * **#1843**: add --keep-relative-links and --resolve-relative-links to resolve relative links
+* **#1981**: fix temporary PDF files not being removed when writing to stdout
 * **#2104**: renamed COPYING to LICENSE
 * **#2104**: renamed COPYING to LICENSE
 * **#2183**: apply --javascript-delay settings for non-main resource loaders
 * **#2183**: apply --javascript-delay settings for non-main resource loaders
 * **#2190**: do not depend on ICU even if it is already installed
 * **#2190**: do not depend on ICU even if it is already installed

+ 4 - 0
src/lib/pdfconverter.cc

@@ -1023,18 +1023,22 @@ void PdfConverterPrivate::printDocument() {
 			!o.open(stdout,QIODevice::WriteOnly) ||
 			!o.open(stdout,QIODevice::WriteOnly) ||
 			!MultiPageLoader::copyFile(i,o) ) {
 			!MultiPageLoader::copyFile(i,o) ) {
 			emit out.error("Count not write to stdout");
 			emit out.error("Count not write to stdout");
+			tempOut.removeAll();
 			fail();
 			fail();
 			return;
 			return;
 		}
 		}
+		tempOut.removeAll();
 	}
 	}
 
 
 	if (settings.out.isEmpty()) {
 	if (settings.out.isEmpty()) {
 		QFile i(lout);
 		QFile i(lout);
 		if (!i.open(QIODevice::ReadOnly)) {
 		if (!i.open(QIODevice::ReadOnly)) {
 			emit out.error("Reading output failed");
 			emit out.error("Reading output failed");
+			tempOut.removeAll();
 			fail();
 			fail();
 		}
 		}
 		outputData = i.readAll();
 		outputData = i.readAll();
+		tempOut.removeAll();
 	}
 	}
 	clearResources();
 	clearResources();
 #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__
 #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__