FIXED: using QSharedPointer for automatic memory management

This commit is contained in:
jkriege2 2024-01-04 23:59:46 +01:00
parent d4930d7729
commit 591f0dfe64

View File

@ -3922,14 +3922,14 @@ bool JKQTBasePlotter::saveAsSVG(const QString& filename, bool displayPreview) {
QString tempFM=""; QString tempFM="";
if (QFile::exists(fn)) { if (QFile::exists(fn)) {
#ifdef QFWIDLIB_LIBRARY #ifdef QFWIDLIB_LIBRARY
QFTemporaryFile* tf=new QFTemporaryFile(); QSharedPointer<QFTemporaryFile> tf=QSharedPointer<QFTemporaryFile>(new QFTemporaryFile());
#else #else
QTemporaryFile* tf=new QTemporaryFile(); QSharedPointer<QTemporaryFile> tf=QSharedPointer<QTemporaryFile>(new QTemporaryFile());
#endif #endif
tf->open(); tf->open();
tempFM=tf->fileName(); tempFM=tf->fileName();
tf->close(); tf->close();
delete tf; tf.reset();
QFile::copy(fn, tempFM); QFile::copy(fn, tempFM);
} }