Check that wxImageList::Create() is not called more than once

Or at least not until Destroy() is called.
This commit is contained in:
Vadim Zeitlin
2021-10-17 15:15:52 +01:00
parent a66e5cdb38
commit 999340f288
2 changed files with 3 additions and 0 deletions

View File

@@ -32,6 +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 = 0;
Create(width, height, mask, initialCount);
}
virtual ~wxImageList();

View File

@@ -73,6 +73,8 @@ wxImageList::wxImageList()
// Creates an image list
bool wxImageList::Create(int width, int height, bool mask, int initial)
{
wxASSERT_MSG( m_hImageList == NULL, "Recreating existing wxImageList?" );
// Prevent from storing negative dimensions
m_size = wxSize(wxMax(width, 0), wxMax(height, 0));
UINT flags = 0;