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();
|
||||
|
||||
// ------------- Set up the printer
|
||||
QPrinter* printer = new QPrinter();
|
||||
auto printer = QScopedPointer<QPrinter>(new QPrinter());
|
||||
|
||||
printer->setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
|
||||
QCoreApplication::applicationVersion());
|
||||
|
@ -788,7 +788,7 @@ void VPMainWindow::generateTiledPdf(QString fileName)
|
|||
|
||||
// ------------- Set up the painter
|
||||
QPainter painter;
|
||||
if (not painter.begin(printer))
|
||||
if (not painter.begin(printer.data()))
|
||||
{ // failed to open file
|
||||
qCritical() << tr("Failed to open file, is it writable?");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user