From c8a5ffdd08a8ddbba27c412ff7008698973b9aa2 Mon Sep 17 00:00:00 2001 From: Gong Heng Date: Wed, 16 Jun 2021 10:52:01 +0800 Subject: [PATCH] fix: Fixed a memory leak issue in actiondefs.cpp. in actiondefs.cpp:80 "actionList = new QList", the actionList not delete. --- fm/src/mainwindow.cpp | 10 ++++++++++ fm/src/mainwindow.h | 1 + 2 files changed, 11 insertions(+) diff --git a/fm/src/mainwindow.cpp b/fm/src/mainwindow.cpp index f9e5c84..ccef8f6 100644 --- a/fm/src/mainwindow.cpp +++ b/fm/src/mainwindow.cpp @@ -250,6 +250,16 @@ MainWindow::MainWindow() QTimer::singleShot(0, this, SLOT(lateStart())); } + +MainWindow::~MainWindow() +{ + if (actionList) { + qDeleteAll(*actionList); + actionList->clear(); + delete actionList; + actionList = nullptr; + } +} //--------------------------------------------------------------------------- /** diff --git a/fm/src/mainwindow.h b/fm/src/mainwindow.h index a0bfba0..0dd8d45 100644 --- a/fm/src/mainwindow.h +++ b/fm/src/mainwindow.h @@ -78,6 +78,7 @@ class MainWindow : public QMainWindow public: MainWindow(); + ~MainWindow(); myModel *modelList; protected: