[0.4.9][EXPLORER] systray notification area - icon crosstalk on NIS_SHARED or NIS_HIDDEN CORE-14262

Fixes a regression introduced by SVN r68893 == git 332652615a
Symptom "TightVNC Server may show a doubled icon and/or corrupts its neighbor icon in the systray"
Fix picked from 0.4.13-dev-481-g8d6c9e8
------------------
I allowed myself to also port the fix for some TRACE-loggings missing ending "\n".
That second regression was introduced during 0.4.8-dev'ing when substantial parts of this code
were moved from trayntfy.cpp into syspager.cpp.
releases/0.4.7 was not affected by that yet.
That 2nd fix was picked from 0.4.13-dev-480-g7796df3
This commit is contained in:
Joachim Henze 2020-10-24 21:10:01 +02:00
parent 65c7d4a17b
commit 6d872b3e7e

View file

@ -444,14 +444,14 @@ UINT WINAPI CIconWatcher::WatcherThread(_In_opt_ LPVOID lpParam)
{
// We've been kicked, we have updates to our list (or we're exiting the thread)
if (This->m_Loop)
TRACE("Updating watched icon list");
TRACE("Updating watched icon list\n");
}
else if ((Status >= WAIT_OBJECT_0 + 1) && (Status < Size))
{
IconWatcherData *Icon;
Icon = This->GetListEntry(NULL, WatchList[Status], false);
TRACE("Pid %lu owns a notification icon and has stopped without deleting it. We'll cleanup on its behalf", Icon->ProcessId);
TRACE("Pid %lu owns a notification icon and has stopped without deleting it. We'll cleanup on its behalf\n", Icon->ProcessId);
TRAYNOTIFYDATAW tnid = {0};
tnid.dwSignature = NI_NOTIFY_SIG;
@ -737,6 +737,7 @@ BOOL CNotifyToolbar::AddButton(_In_ CONST NOTIFYICONDATA *iconData)
tbBtn.dwData = (DWORD_PTR)notifyItem;
tbBtn.iString = (INT_PTR) text;
tbBtn.idCommand = GetButtonCount();
tbBtn.iBitmap = -1;
if (iconData->uFlags & NIF_STATE)
{
@ -832,7 +833,7 @@ BOOL CNotifyToolbar::UpdateButton(_In_ CONST NOTIFYICONDATA *iconData)
InternalIconData * notifyItem;
TBBUTTONINFO tbbi = { 0 };
TRACE("Updating icon %d from hWnd %08x flags%s%s state%s%s",
TRACE("Updating icon %d from hWnd %08x flags%s%s state%s%s\n",
iconData->uID, iconData->hWnd,
(iconData->uFlags & NIF_ICON) ? " ICON" : "",
(iconData->uFlags & NIF_STATE) ? " STATE" : "",
@ -842,7 +843,7 @@ BOOL CNotifyToolbar::UpdateButton(_In_ CONST NOTIFYICONDATA *iconData)
int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
if (index < 0)
{
WARN("Icon %d from hWnd %08x DOES NOT EXIST!", iconData->uID, iconData->hWnd);
WARN("Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
return AddButton(iconData);
}
@ -941,7 +942,7 @@ BOOL CNotifyToolbar::RemoveButton(_In_ CONST NOTIFYICONDATA *iconData)
int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
if (index < 0)
{
TRACE("Icon %d from hWnd %08x ALREADY MISSING!", iconData->uID, iconData->hWnd);
TRACE("Icon %d from hWnd %08x ALREADY MISSING!\n", iconData->uID, iconData->hWnd);
return FALSE;
}