[NETSHELL]

- Fix icon handle leaks in the network status taskbar icon

svn path=/trunk/; revision=53037
This commit is contained in:
Cameron Gutman 2011-08-02 22:18:57 +00:00
parent 3d34260a62
commit b0f4c80bdd

View file

@ -252,6 +252,9 @@ UpdateLanStatus(HWND hwndDlg, LANSTATUSUI_CONTEXT * pContext)
Shell_NotifyIconW(NIM_MODIFY, &nid); Shell_NotifyIconW(NIM_MODIFY, &nid);
if (nid.uFlags & NIF_ICON)
DestroyIcon(nid.hIcon);
pContext->dwInOctets = IfEntry.dwInOctets; pContext->dwInOctets = IfEntry.dwInOctets;
pContext->dwOutOctets = IfEntry.dwOutOctets; pContext->dwOutOctets = IfEntry.dwOutOctets;
@ -1002,7 +1005,7 @@ InitializeNetTaskbarNotifications(
ZeroMemory(&nid, sizeof(nid)); ZeroMemory(&nid, sizeof(nid));
nid.cbSize = sizeof(nid); nid.cbSize = sizeof(nid);
nid.uID = Index++; nid.uID = Index++;
nid.uFlags = NIF_ICON | NIF_MESSAGE; nid.uFlags = NIF_MESSAGE;
nid.u.uVersion = 3; nid.u.uVersion = 3;
nid.uCallbackMessage = WM_SHOWSTATUSDLG; nid.uCallbackMessage = WM_SHOWSTATUSDLG;
nid.hWnd = hwndDlg; nid.hWnd = hwndDlg;
@ -1022,6 +1025,8 @@ InitializeNetTaskbarNotifications(
else if (pProps->Status == NCS_CONNECTED) else if (pProps->Status == NCS_CONNECTED)
nid.hIcon = LoadIcon(netshell_hInstance, MAKEINTRESOURCE(IDI_NET_IDLE)); nid.hIcon = LoadIcon(netshell_hInstance, MAKEINTRESOURCE(IDI_NET_IDLE));
if (nid.hIcon)
nid.uFlags |= NIF_ICON;
wcscpy(nid.szTip, pProps->pszwName); wcscpy(nid.szTip, pProps->pszwName);
nid.uFlags |= NIF_TIP; nid.uFlags |= NIF_TIP;
@ -1043,6 +1048,9 @@ InitializeNetTaskbarNotifications(
{ {
CoTaskMemFree(pItem); CoTaskMemFree(pItem);
} }
if (nid.uFlags & NIF_ICON)
DestroyIcon(nid.hIcon);
} }
} }
}while(hr == S_OK); }while(hr == S_OK);