From: lx-s Date: Wed, 8 Jul 2026 08:40:26 +0000 (+0200) Subject: use fixed brush to avoid leak X-Git-Tag: 2.6.0.0~90 X-Git-Url: https://repos.lx-s.de/gitweb/?a=commitdiff_plain;h=3167752f109a654e7454283f130080f0b3f9bb94;p=winmute.git use fixed brush to avoid leak --- diff --git a/WinMute/WinMute.cpp b/WinMute/WinMute.cpp index 37b75e2..feb6c6d 100644 --- a/WinMute/WinMute.cpp +++ b/WinMute/WinMute.cpp @@ -128,7 +128,8 @@ bool WinMute::RegisterWindowClass() WNDCLASSEX wc = { 0 }; wc.cbSize = sizeof(wc); wc.hIcon = LoadIcon(hglobInstance, MAKEINTRESOURCE(IDI_APP)); - wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); + // System color index brush: no GDI object to leak, tracks theme changes + wc.hbrBackground = reinterpret_cast(COLOR_BTNFACE + 1); wc.hInstance = hglobInstance; wc.lpfnWndProc = WinMuteWndProc; wc.lpszClassName = WINMUTE_CLASS_NAME; @@ -243,12 +244,12 @@ bool WinMute::Init() hTrayIcon_ = LoadIconW(hglobInstance, MAKEINTRESOURCE(IDI_APP)); if (hTrayIcon_ == nullptr) { - ShowWindowsError(_T("LoadIcon")); + ShowWindowsError(L"LoadIcon"); return false; } hUpdateIcon_ = LoadIconW(hglobInstance, MAKEINTRESOURCE(IDI_APPUPDATE)); if (hUpdateIcon_ == nullptr) { - ShowWindowsError(_T("LoadIcon")); + ShowWindowsError(L"LoadIcon"); return false; } wmTray_.Init(hWnd_, 0, hTrayIcon_, L"WinMute", true);