Fix double free in mainwindow.cpp (#726)

This commit is contained in:
Kous 2024-07-14 21:44:47 +02:00
parent cdb354f86b
commit f7f324ad43
2 changed files with 5 additions and 8 deletions

View File

@ -192,8 +192,7 @@ MainWindow::MainWindow(const QString &tversion)
mainWidget = new QWidget(this); mainWidget = new QWidget(this);
//qDebug() << Q_FUNC_INFO << ": 60 " << QTime::currentTime().toString("hh:mm:ss") ; //qDebug() << Q_FUNC_INFO << ": 60 " << QTime::currentTime().toString("hh:mm:ss") ;
dateTime = new QDateTime(); dateTime = std::make_unique<QDateTime>();
dateTimeTemp = new QDateTime();
// UI DX // UI DX
infoLabel2 = new QLabel(tr("DX Entity")); infoLabel2 = new QLabel(tr("DX Entity"));
loggWinAct = new QAction(tr("&Log Window"), this); loggWinAct = new QAction(tr("&Log Window"), this);
@ -251,8 +250,7 @@ MainWindow::~MainWindow()
delete(locator); delete(locator);
delete(qso); delete(qso);
delete(backupQSO); delete(backupQSO);
delete(dateTime); dateTime.reset();
delete(dateTimeTemp);
delete(awards); delete(awards);
delete(softUpdate); delete(softUpdate);
delete(filemanager); delete(filemanager);
@ -2214,7 +2212,6 @@ void MainWindow::slotClearButtonClicked(const QString &_func)
setModifying(false); setModifying(false);
currentEntity = -1; currentEntity = -1;
dateTimeTemp = dateTime;
modifyingQSO = -1; modifyingQSO = -1;
QSOTabWidget->setRSTToMode(mainQSOEntryWidget->getMode(), readingTheUI); QSOTabWidget->setRSTToMode(mainQSOEntryWidget->getMode(), readingTheUI);
@ -4682,8 +4679,6 @@ void MainWindow::qsoToEdit (const int _qso)
mainQSOEntryWidget->setDateTime(qsoE.getDateTimeOn()); mainQSOEntryWidget->setDateTime(qsoE.getDateTimeOn());
dateTimeTemp->setDate(qsoE.getDate());
mainQSOEntryWidget->setBand(qsoE.getBand()); mainQSOEntryWidget->setBand(qsoE.getBand());
//qDebug() << Q_FUNC_INFO << " - RST" ; //qDebug() << Q_FUNC_INFO << " - RST" ;

View File

@ -81,6 +81,8 @@
#include "updatesettings.h" #include "updatesettings.h"
#include "klogdefinitions.h" #include "klogdefinitions.h"
#include <memory>
class QTimer; class QTimer;
class QDateTime; class QDateTime;
@ -625,7 +627,7 @@ private:
// </UI> // </UI>
int infoTimeout; // timeout that temporary info will stay in the infobars int infoTimeout; // timeout that temporary info will stay in the infobars
QTimer *timer, *timerInfoBars; QTimer *timer, *timerInfoBars;
QDateTime *dateTime, *dateTimeTemp; std::unique_ptr<QDateTime> dateTime;
bool yearChangedDuringModification; bool yearChangedDuringModification;
QString infoLabel1T, infoLabel2T; QString infoLabel1T, infoLabel2T;