mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-01 17:58:29 +00:00
- Added cleanup routine for ImageList
- Fixed memory leak in ComboBoxTestModel
This commit is contained in:
parent
ac7cb4081f
commit
2648ed168a
@ -59,7 +59,8 @@ private:
|
||||
std::vector<uistring> list;
|
||||
win32cpp::ImageList* il;
|
||||
public:
|
||||
ComboBoxTestModel() {
|
||||
ComboBoxTestModel()
|
||||
{
|
||||
il = new win32cpp::ImageList(16, 16, win32cpp::ImageList::Color32);
|
||||
il->Add(_T("resources\\test_combobox.bmp"));
|
||||
|
||||
@ -70,6 +71,11 @@ public:
|
||||
list.push_back(_T("test"));
|
||||
}
|
||||
|
||||
~ComboBoxTestModel()
|
||||
{
|
||||
delete il;
|
||||
}
|
||||
|
||||
virtual win32cpp::ImageList* ImageList()
|
||||
{
|
||||
return il;
|
||||
|
@ -50,6 +50,9 @@ model(ComboBox::sNullModel)
|
||||
{
|
||||
}
|
||||
|
||||
ComboBox::~ComboBox()
|
||||
{
|
||||
}
|
||||
|
||||
HWND ComboBox::Create(Window* parent)
|
||||
{
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
typedef sigslot::signal1<ComboBox*> SelectionChangedEvent;
|
||||
|
||||
ComboBox();
|
||||
~ComboBox();
|
||||
|
||||
void SetModel(ModelRef model);
|
||||
int Selected();
|
||||
|
@ -59,6 +59,18 @@ ImageList::ImageList(int width, int height, ImageList::ColorDepth depth) :
|
||||
|
||||
ImageList::~ImageList()
|
||||
{
|
||||
for(int i = 0; i < this->Count(); i++) {
|
||||
IMAGEINFO info;
|
||||
|
||||
this->Info(i, &info);
|
||||
|
||||
DeleteObject(info.hbmImage);
|
||||
if(info.hbmMask) DeleteObject(info.hbmMask);
|
||||
|
||||
this->Remove(i);
|
||||
}
|
||||
|
||||
::ImageList_Destroy(this->imagelistHandle);
|
||||
}
|
||||
|
||||
HIMAGELIST ImageList::Handle() const
|
||||
@ -73,7 +85,7 @@ int ImageList::Count() const
|
||||
|
||||
int ImageList::Add(HBITMAP image)
|
||||
{
|
||||
return ::ImageList_Add(this->imagelistHandle, image, image);
|
||||
return ::ImageList_Add(this->imagelistHandle, image, NULL);
|
||||
}
|
||||
|
||||
int ImageList::Add(const uistring& filename, bool transparence)
|
||||
|
Loading…
Reference in New Issue
Block a user