From 6b3fd04e24d20530b276de5307cbc6737b0c6a4d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Oct 2021 01:00:19 +0100 Subject: [PATCH] Initialize wxGenericImageList members in default ctor Don't leave m_useMask and m_scaleFactor uninitialized -- even if this probably doesn't matter, call Create() to make sure they have well-defined values for the default-constructed objects. --- include/wx/generic/imaglist.h | 2 +- src/generic/imaglist.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index a720c36a2d..b29c495571 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -22,7 +22,7 @@ class WXDLLIMPEXP_FWD_CORE wxColour; class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject { public: - wxGenericImageList() { } + wxGenericImageList(); wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); virtual ~wxGenericImageList(); bool Create( int width, int height, bool mask = true, int initialCount = 1 ); diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index b72dd29d51..83e5173ab8 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -29,6 +29,11 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxGenericImageList, wxObject); wxIMPLEMENT_DYNAMIC_CLASS(wxImageList, wxGenericImageList); +wxGenericImageList::wxGenericImageList() +{ + Create(0, 0, false); +} + wxGenericImageList::wxGenericImageList( int width, int height, bool mask, int initialCount ) { (void)Create(width, height, mask, initialCount);