From 7d92f321c7c8b0422f330c995f804a9639339f7b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 6 Feb 2022 22:38:25 +0000 Subject: [PATCH] Add wxImageList::Init() to wxMSW version Initialize all fields in a single place, just as it's done in most of the other classes. No real changes. --- include/wx/msw/imaglist.h | 12 ++++++++++-- src/msw/imaglist.cpp | 6 ------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/wx/msw/imaglist.h b/include/wx/msw/imaglist.h index fde871c32e..404d8aadd0 100644 --- a/include/wx/msw/imaglist.h +++ b/include/wx/msw/imaglist.h @@ -24,7 +24,7 @@ public: * Public interface */ - wxImageList(); + wxImageList() { Init(); } // Creates an image list. // Specify the width and height of the images in the list, @@ -32,7 +32,7 @@ public: // from icons), and the initial size of the list. wxImageList(int width, int height, bool mask = true, int initialCount = 1) { - m_hImageList = NULL; + Init(); Create(width, height, mask, initialCount); } virtual ~wxImageList(); @@ -198,8 +198,16 @@ public: protected: WXHIMAGELIST m_hImageList; wxSize m_size; + +private: bool m_useMask; + void Init() + { + m_hImageList = NULL; + m_useMask = false; + } + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList); }; diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index de3b4fe564..c52c390065 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -64,12 +64,6 @@ static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask); // wxImageList creation/destruction // ---------------------------------------------------------------------------- -wxImageList::wxImageList() - : m_hImageList(NULL) - , m_useMask(false) -{ -} - // Creates an image list bool wxImageList::Create(int width, int height, bool mask, int initial) {