diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-06-17 12:42:25 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-06-17 11:33:29 +0000 |
commit | fb13a124c1349b712839eebbadea04923fa97175 (patch) | |
tree | 87d1f3ae4e6f6ecfe3d738f6fddd288529ea1424 /src/plugins/marketplace | |
parent | 92bae70432e6d05ccdf36216265d9802d8ca763c (diff) |
Marketplace: Fix leak
Change-Id: Ifd31a38514a630e9b8e36d4255dc4de6d6588925
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/marketplace')
-rw-r--r-- | src/plugins/marketplace/productlistmodel.cpp | 7 | ||||
-rw-r--r-- | src/plugins/marketplace/productlistmodel.h | 1 |
2 files changed, 5 insertions, 3 deletions
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<Section, ProductGridView *> 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; |