From 675edad96f8dfec3b1fd2a3a88b877eca2e8f039 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Wed, 9 Jun 2021 22:56:53 +0200 Subject: [PATCH] [RAPPS] Fix double free when closing rapps --- base/applications/rapps/appview.cpp | 14 ++++++++++---- base/applications/rapps/include/appview.h | 7 ++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/base/applications/rapps/appview.cpp b/base/applications/rapps/appview.cpp index 57442cd0e80..aa908ffcf2c 100644 --- a/base/applications/rapps/appview.cpp +++ b/base/applications/rapps/appview.cpp @@ -1113,12 +1113,18 @@ CAppInfoDisplay::~CAppInfoDisplay() // **** CAppsListView **** -CAppsListView::CAppsListView() : - bHasCheckboxes(FALSE), - nLastHeaderID(-1) +CAppsListView::CAppsListView() { } +CAppsListView::~CAppsListView() +{ + if (m_hImageListView) + { + ImageList_Destroy(m_hImageListView); + } +} + VOID CAppsListView::SetCheckboxesVisible(BOOL bIsVisible) { if (bIsVisible) @@ -1253,7 +1259,7 @@ INT CAppsListView::CompareFunc(LPARAM lParam1, LPARAM lParam2, INT iSubItem) HWND CAppsListView::Create(HWND hwndParent) { RECT r = { 205, 28, 465, 250 }; - DWORD style = WS_CHILD | WS_VISIBLE | LVS_SORTASCENDING | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE; + DWORD style = WS_CHILD | WS_VISIBLE | LVS_SORTASCENDING | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_SHAREIMAGELISTS; HWND hwnd = CListView::Create(hwndParent, r, NULL, style, WS_EX_CLIENTEDGE); diff --git a/base/applications/rapps/include/appview.h b/base/applications/rapps/include/appview.h index 668131245ce..192a59c7489 100644 --- a/base/applications/rapps/include/appview.h +++ b/base/applications/rapps/include/appview.h @@ -211,20 +211,21 @@ class CAppsListView : }; BOOL bIsAscending = TRUE; - BOOL bHasCheckboxes; + BOOL bHasCheckboxes = FALSE; INT ItemCount = 0; INT CheckedItemCount = 0; INT ColumnCount = 0; - INT nLastHeaderID; + INT nLastHeaderID = -1; APPLICATION_VIEW_TYPE ApplicationViewType = AppViewTypeEmpty; - HIMAGELIST m_hImageListView; + HIMAGELIST m_hImageListView = NULL; public: CAppsListView(); + ~CAppsListView(); VOID SetCheckboxesVisible(BOOL bIsVisible);