diff --git a/include/wx/msw/imaglist.h b/include/wx/msw/imaglist.h index 44078ef53a..2291407a2f 100644 --- a/include/wx/msw/imaglist.h +++ b/include/wx/msw/imaglist.h @@ -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(); diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index ac20046311..de3b4fe564 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -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;