Index: base/shell/explorer/trayntfy.cpp =================================================================== --- base/shell/explorer/trayntfy.cpp (revision 67578) +++ base/shell/explorer/trayntfy.cpp (working copy) @@ -256,7 +256,22 @@ NOTIFYICONDATA * notifyItem = GetItemData(wIndex); if (!::IsWindow(notifyItem->hWnd)) + { + //we detect and destroy icons with invalid handles only on mouse move over systray, same as MS does + //alternatively we could search for them periodically (would waste more resources) + TRACE("destroying icon with invalid handle\n"); + RECT windowRect; + HWND parentHWND = GetParent(); + parentHWND = ::GetParent(parentHWND); + ::GetClientRect(parentHWND, &windowRect); + RemoveButton(notifyItem); + SendMessage(parentHWND, + WM_SIZE, + 0, + MAKELONG(windowRect.right - windowRect.left, + windowRect.bottom - windowRect.top)); return; + } if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) {