Fix GDI leak in setStartupBgColor

- remove unneeded icon color constants

Fix #16442, close #16443
This commit is contained in:
ozone10 2025-04-18 19:14:50 +02:00 committed by Don Ho
parent 4ddad4683b
commit 9f2326d30c
2 changed files with 7 additions and 11 deletions

View File

@ -54,12 +54,13 @@ void Notepad_plus_Window::setStartupBgColor(COLORREF BgColor)
RECT windowClientArea;
HDC hdc = GetDCEx(_hSelf, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE); //lock window update flag due to PaintLocker
GetClientRect(_hSelf, &windowClientArea);
FillRect(hdc, &windowClientArea, CreateSolidBrush(BgColor));
HBRUSH hBrush = ::CreateSolidBrush(BgColor);
::FillRect(hdc, &windowClientArea, hBrush);
::DeleteObject(hBrush);
ReleaseDC(_hSelf, hdc);
}
void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const wchar_t *cmdLine, CmdLineParams *cmdLineParams)
{
Window::init(hInst, parent);

View File

@ -392,13 +392,8 @@ namespace NppDarkMode
return opt;
}
constexpr COLORREF cDefaultMainDark = RGB(0xDE, 0xDE, 0xDE);
constexpr COLORREF cDefaultSecondaryDark = RGB(0x4C, 0xC2, 0xFF);
constexpr COLORREF cDefaultMainLight = RGB(0x21, 0x21, 0x21);
constexpr COLORREF cDefaultSecondaryLight = RGB(0x00, 0x78, 0xD4);
static COLORREF cAccentDark = cDefaultSecondaryDark;
static COLORREF cAccentLight = cDefaultSecondaryLight;
static COLORREF cAccentDark = g_cDefaultSecondaryDark;
static COLORREF cAccentLight = g_cDefaultSecondaryLight;
static COLORREF adjustClrLightness(COLORREF clr, bool useDark)
{
@ -436,8 +431,8 @@ namespace NppDarkMode
return true;
}
cAccentDark = cDefaultSecondaryDark;
cAccentLight = cDefaultSecondaryLight;
cAccentDark = g_cDefaultSecondaryDark;
cAccentLight = g_cDefaultSecondaryLight;
return false;
}