From c61087ed5d10b055f100529fc3c7161220dfa11b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 4 May 2021 09:21:34 +0300 Subject: [PATCH] Fix potential memory leak. --- src/app/puzzle/vpmainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index e4c5b500d..a5b0378c7 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -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(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;