Make GetUpdatedImageListFor() work when using old API too

Return the image list set via {Set,Assign}ImageList() if SetImages()
hadn't been called to make this function return the correct image list
in any case, both when using the old wxImageList API and the new one
using wxBitmapBundle.

This commit is best viewed ignoring whitespace-only changes.
This commit is contained in:
Vadim Zeitlin
2021-11-11 01:18:55 +00:00
parent 907f6da047
commit 9ea8feec37

View File

@@ -108,16 +108,16 @@ public:
// the appropriate size for the given window, and returns it.
wxImageList* GetUpdatedImageListFor(wxWindow* win)
{
if ( m_images.empty() )
return NULL;
if ( !m_images.empty() )
{
// Note that we can't just call AssignImageList() here to avoid
// infinite recursion.
FreeIfNeeded();
m_imageList = wxBitmapBundle::CreateImageList(win, m_images);
// Note that we can't just call AssignImageList() here to avoid
// infinite recursion.
FreeIfNeeded();
m_imageList = wxBitmapBundle::CreateImageList(win, m_images);
// We always own it as we created it ourselves.
m_ownsImageList = true;
// We always own it as we created it ourselves.
m_ownsImageList = true;
}
return m_imageList;
}