From 8a1a5d22596deb2fe1af06ed525ac93f28ed8fae Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 10 Aug 2023 15:06:36 +0200 Subject: [PATCH] GalleryDialog: Fixed a memory leak --- src/slic3r/GUI/GalleryDialog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GalleryDialog.cpp b/src/slic3r/GUI/GalleryDialog.cpp index a08673e235..5ac51d54f7 100644 --- a/src/slic3r/GUI/GalleryDialog.cpp +++ b/src/slic3r/GUI/GalleryDialog.cpp @@ -134,7 +134,12 @@ GalleryDialog::GalleryDialog(wxWindow* parent) : } GalleryDialog::~GalleryDialog() -{ +{ + // From wxWidgets docs: + // The method void wxListCtrl::SetImageList(wxImageList* imageList, int which) + // does not take ownership of the image list, you have to delete it yourself. + if (m_image_list) + delete m_image_list; } int GalleryDialog::show(bool show_from_menu)