From 591f0dfe6482de18024dbd8a50d59920a922a1cb Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Thu, 4 Jan 2024 23:59:46 +0100 Subject: [PATCH] FIXED: using QSharedPointer for automatic memory management --- lib/jkqtplotter/jkqtpbaseplotter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 807da11f56..36372850bc 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -3922,14 +3922,14 @@ bool JKQTBasePlotter::saveAsSVG(const QString& filename, bool displayPreview) { QString tempFM=""; if (QFile::exists(fn)) { #ifdef QFWIDLIB_LIBRARY - QFTemporaryFile* tf=new QFTemporaryFile(); + QSharedPointer tf=QSharedPointer(new QFTemporaryFile()); #else - QTemporaryFile* tf=new QTemporaryFile(); + QSharedPointer tf=QSharedPointer(new QTemporaryFile()); #endif tf->open(); tempFM=tf->fileName(); tf->close(); - delete tf; + tf.reset(); QFile::copy(fn, tempFM); }