-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Description of the Issue
Function
notepad-plus-plus/PowerEditor/src/WinControls/ImageListSet/ImageListSet.cpp
Lines 95 to 104 in 6bc7abb
| bool IconList::changeIcon(size_t index, const wchar_t *iconLocation) const | |
| { | |
| HBITMAP hBmp = (HBITMAP)::LoadImage(_hInst, iconLocation, IMAGE_ICON, _iconSize, _iconSize, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); | |
| if (!hBmp) | |
| return false; | |
| size_t i = ImageList_ReplaceIcon(_hImglst, int(index), (HICON)hBmp); | |
| ImageList_AddMasked(_hImglst, (HBITMAP)hBmp, RGB(255,0,255)); | |
| ::DeleteObject(hBmp); | |
| return (i == index); | |
| } |
is implemented wrong,
HICON and HBITMAP are different types which cannot be interchanged. Casting one to other can cause undefined behavior. Icon should already support transparency so adding mask is not needed and can cause issue.
Steps To Reproduce
- Use custom icons
- In preference change toolbar icon set several times
- Observe visual glitch and eventually crash, this can be speed up by also switching between dark and light mode
Current Behavior
Potential visual glitches and crash.
Expected Behavior
No visual glitches and crash.
Debug Information
Notepad++ v8.7.9Anything else?
No response
Reactions are currently unavailable