From fb13a124c1349b712839eebbadea04923fa97175 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 17 Jun 2020 12:42:25 +0200 Subject: Marketplace: Fix leak Change-Id: Ifd31a38514a630e9b8e36d4255dc4de6d6588925 Reviewed-by: Christian Stenger --- src/plugins/marketplace/productlistmodel.cpp | 7 ++++--- src/plugins/marketplace/productlistmodel.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/marketplace') diff --git a/src/plugins/marketplace/productlistmodel.cpp b/src/plugins/marketplace/productlistmodel.cpp index bceb6595fa..0e240cc243 100644 --- a/src/plugins/marketplace/productlistmodel.cpp +++ b/src/plugins/marketplace/productlistmodel.cpp @@ -164,6 +164,7 @@ SectionedProducts::SectionedProducts(QWidget *parent) : QStackedWidget(parent) , m_allProductsView(new ProductGridView(this)) , m_filteredAllProductsModel(new Core::ListModelFilter(new AllProductsModel(this), this)) + , m_gridModel(new Core::GridProxyModel) , m_productDelegate(new ProductItemDelegate) { auto area = new QScrollArea(this); @@ -180,10 +181,9 @@ SectionedProducts::SectionedProducts(QWidget *parent) addWidget(area); - auto gridModel = new Core::GridProxyModel; - gridModel->setSourceModel(m_filteredAllProductsModel); + m_gridModel->setSourceModel(m_filteredAllProductsModel); m_allProductsView->setItemDelegate(m_productDelegate); - m_allProductsView->setModel(gridModel); + m_allProductsView->setModel(m_gridModel); addWidget(m_allProductsView); connect(m_productDelegate, &ProductItemDelegate::tagClicked, @@ -194,6 +194,7 @@ SectionedProducts::~SectionedProducts() { qDeleteAll(m_gridViews.values()); delete m_productDelegate; + delete m_gridModel; } void SectionedProducts::updateCollections() diff --git a/src/plugins/marketplace/productlistmodel.h b/src/plugins/marketplace/productlistmodel.h index cda47b52da..42d13dc417 100644 --- a/src/plugins/marketplace/productlistmodel.h +++ b/src/plugins/marketplace/productlistmodel.h @@ -111,6 +111,7 @@ private: QMap m_gridViews; ProductGridView *m_allProductsView = nullptr; Core::ListModelFilter *m_filteredAllProductsModel = nullptr; + Core::GridProxyModel * const m_gridModel; ProductItemDelegate *m_productDelegate = nullptr; bool m_isDownloadingImage = false; int m_columnCount = 1; -- cgit v1.2.3