Fix potential memory leak.
This commit is contained in:
parent
ca20519fa7
commit
c61087ed5d
|
@ -765,7 +765,7 @@ void VPMainWindow::generateTiledPdf(QString fileName)
|
||||||
PageOrientation tilesOrientation = m_layout->GetTilesOrientation();
|
PageOrientation tilesOrientation = m_layout->GetTilesOrientation();
|
||||||
|
|
||||||
// ------------- Set up the printer
|
// ------------- Set up the printer
|
||||||
QPrinter* printer = new QPrinter();
|
auto printer = QScopedPointer<QPrinter>(new QPrinter());
|
||||||
|
|
||||||
printer->setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
|
printer->setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
|
||||||
QCoreApplication::applicationVersion());
|
QCoreApplication::applicationVersion());
|
||||||
|
@ -788,7 +788,7 @@ void VPMainWindow::generateTiledPdf(QString fileName)
|
||||||
|
|
||||||
// ------------- Set up the painter
|
// ------------- Set up the painter
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
if (not painter.begin(printer))
|
if (not painter.begin(printer.data()))
|
||||||
{ // failed to open file
|
{ // failed to open file
|
||||||
qCritical() << tr("Failed to open file, is it writable?");
|
qCritical() << tr("Failed to open file, is it writable?");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user