From 54d565d2d323b40c7b6117fb4d769e1aba30bbb9 Mon Sep 17 00:00:00 2001 From: Semenov Herman Date: Thu, 29 Aug 2024 01:29:29 +0300 Subject: [PATCH] fix: fixed memleaks and predefinedfilterscombobox and abstractlogview --- src/ui/include/predefinedfilterscombobox.h | 1 + src/ui/src/abstractlogview.cpp | 2 ++ src/ui/src/predefinedfilterscombobox.cpp | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/src/ui/include/predefinedfilterscombobox.h b/src/ui/include/predefinedfilterscombobox.h index 1554cf195..6d97ac2d7 100644 --- a/src/ui/include/predefinedfilterscombobox.h +++ b/src/ui/include/predefinedfilterscombobox.h @@ -51,6 +51,7 @@ class PredefinedFiltersComboBox final : public QComboBox { public: explicit PredefinedFiltersComboBox( QWidget* parent ); + ~PredefinedFiltersComboBox(); PredefinedFiltersComboBox( const PredefinedFiltersComboBox& other ) = delete; PredefinedFiltersComboBox( PredefinedFiltersComboBox&& other ) noexcept = delete; diff --git a/src/ui/src/abstractlogview.cpp b/src/ui/src/abstractlogview.cpp index e4694a776..dfde61b07 100644 --- a/src/ui/src/abstractlogview.cpp +++ b/src/ui/src/abstractlogview.cpp @@ -536,9 +536,11 @@ AbstractLogView::~AbstractLogView() try { if ( quickFind_ ) { quickFind_->stopSearch(); + delete quickFind_; } } catch ( const std::exception& e ) { LOG_ERROR << "Failed to stop search: " << e.what(); + delete quickFind_; } } diff --git a/src/ui/src/predefinedfilterscombobox.cpp b/src/ui/src/predefinedfilterscombobox.cpp index 0f557938f..665ed9a09 100644 --- a/src/ui/src/predefinedfilterscombobox.cpp +++ b/src/ui/src/predefinedfilterscombobox.cpp @@ -102,6 +102,11 @@ PredefinedFiltersComboBox::PredefinedFiltersComboBox( QWidget* parent ) setSizeAdjustPolicy( QComboBox::AdjustToContents ); } +PredefinedFiltersComboBox::~PredefinedFiltersComboBox() +{ + delete model_; +} + void PredefinedFiltersComboBox::populatePredefinedFilters() { model_->clear(); @@ -172,6 +177,7 @@ void PredefinedFiltersComboBox::setTitle( const QString& title ) { auto* titleItem = new QStandardItem( title ); model_->insertRow( 0, titleItem ); + delete titleItem; } void PredefinedFiltersComboBox::insertFilters(