Fix memory leak when toggling to and from Dark Mode
Fix the memory leak due to icons of toolbar - they are not removed from ImageList while switching between dark/lite mode. Fix #10957, close #10966
This commit is contained in:
parent
c0989d472c
commit
79fa0abc8b
|
@ -99,6 +99,11 @@ void ToolBarIcons::reInit(int size)
|
||||||
ImageList_SetIconSize(getDefaultLstSetDM2(), size, size);
|
ImageList_SetIconSize(getDefaultLstSetDM2(), size, size);
|
||||||
ImageList_SetIconSize(getDisableLstSetDM2(), size, size);
|
ImageList_SetIconSize(getDisableLstSetDM2(), size, size);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < _iconListVector.size(); ++i)
|
||||||
|
{
|
||||||
|
_iconListVector[i].removeAll();
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0, len = _tbiis.size(); i < len; ++i)
|
for (size_t i = 0, len = _tbiis.size(); i < len; ++i)
|
||||||
{
|
{
|
||||||
if (_tbiis[i]._defaultIcon != -1)
|
if (_tbiis[i]._defaultIcon != -1)
|
||||||
|
|
|
@ -33,6 +33,11 @@ public :
|
||||||
void destroy() {
|
void destroy() {
|
||||||
ImageList_Destroy(_hImglst);
|
ImageList_Destroy(_hImglst);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void removeAll() {
|
||||||
|
ImageList_RemoveAll(_hImglst);
|
||||||
|
};
|
||||||
|
|
||||||
HIMAGELIST getHandle() const {return _hImglst;};
|
HIMAGELIST getHandle() const {return _hImglst;};
|
||||||
void addIcon(int iconID) const;
|
void addIcon(int iconID) const;
|
||||||
void addIcon(HICON hIcon) const;
|
void addIcon(HICON hIcon) const;
|
||||||
|
|
Loading…
Reference in New Issue