aboutsummaryrefslogtreecommitdiff
path: root/print/scribus-devel/files/patch-scribus_plugins_import_pdf_importpdf.cpp
blob: 032a42a5c3f1d02fa282f0d9277f29873f4c0ebb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
--- scribus/plugins/import/pdf/importpdf.cpp.orig	2020-03-15 14:15:45 UTC
+++ scribus/plugins/import/pdf/importpdf.cpp
@@ -75,7 +75,7 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
 QImage PdfPlug::readThumbnail(const QString& fName)
 {
 	QString pdfFile = QDir::toNativeSeparators(fName);
-	globalParams = new GlobalParams();
+	globalParams.reset(new GlobalParams());
 	if (globalParams)
 	{
 #if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
@@ -90,7 +90,6 @@ QImage PdfPlug::readThumbnail(const QString& fName)
 			if (pdfDoc->getErrorCode() == errEncrypted)
 			{
 				delete pdfDoc;
-				delete globalParams;
 				return QImage();
 			}
 			if (pdfDoc->isOk())
@@ -134,11 +133,9 @@ QImage PdfPlug::readThumbnail(const QString& fName)
 				image.setText("YSize", QString("%1").arg(h));
 				delete dev;
 				delete pdfDoc;
-				delete globalParams;
 				return image;
 			}
 			delete pdfDoc;
-			delete globalParams;
 		}
 	}
 	return QImage();
@@ -387,7 +384,7 @@ bool PdfPlug::convert(const QString& fn)
 		qApp->processEvents();
 	}
 
-	globalParams = new GlobalParams();
+	globalParams.reset(new GlobalParams());
 	GooString *userPW = nullptr;
 	if (globalParams)
 	{
@@ -429,7 +426,6 @@ bool PdfPlug::convert(const QString& fn)
 					if (progressDialog)
 						progressDialog->close();
 					delete pdfDoc;
-					delete globalParams;
 					return false;
 				}
 				if (progressDialog)
@@ -474,7 +470,6 @@ bool PdfPlug::convert(const QString& fn)
 							progressDialog->close();
 						delete optImp;
 						delete pdfDoc;
-						delete globalParams;
 						return false;
 					}
 					pageString = optImp->getPagesString();
@@ -839,13 +834,13 @@ bool PdfPlug::convert(const QString& fn)
 								if (names.isDict())
 								{
 									LinkAction *linkAction = nullptr;
-									linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
+									linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI()).get();
 									if (linkAction)
 									{
 										LinkJavaScript *jsa = (LinkJavaScript*)linkAction;
 										if (jsa->isOk())
 										{
-											QString script = UnicodeParsedString(jsa->getScript());
+											QString script = QString::fromStdString(jsa->getScript());
 											if (script.startsWith("this."))
 											{
 												script.remove(0, 5);
@@ -908,7 +903,7 @@ bool PdfPlug::convert(const QString& fn)
 		}
 		delete pdfDoc;
 	}
-	delete globalParams;
+	globalParams.release();
 	globalParams = nullptr;
 
 //	qDebug() << "converting finished";