diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-07 20:20:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-07 20:20:17 +0000 |
commit | ba275795eba1936a3c395527cc55936a4dc02f9d (patch) | |
tree | 549685873bcc8e4e4447d8efa9c74ecab6af97ba | |
parent | 284caa432d31130a2714ce6acb49826d55b8789d (diff) |
memory leak in Clist modern
git-svn-id: http://svn.miranda-ng.org/main/trunk@14060 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Clist_modern/src/modern_clisttray.cpp | 11 | ||||
-rw-r--r-- | src/modules/clist/clisttray.cpp | 17 |
2 files changed, 15 insertions, 13 deletions
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index cd3f19d1c6..d24302d8e8 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -636,14 +636,15 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) break;
}
- DestroyIcon(pcli->trayIcon[i].hBaseIcon);
- pcli->trayIcon[i].hBaseIcon = hIcon;
- pcli->trayIcon[i].ptszToolTip = mir_tstrdup(pcli->szTip);
+ trayIconInfo_t &p = pcli->trayIcon[i];
+ DestroyIcon(p.hBaseIcon);
+ p.hBaseIcon = hIcon;
+ replaceStrT(p.ptszToolTip, pcli->szTip);
NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA) };
nid.hWnd = pcli->hwndContactList;
- nid.uID = pcli->trayIcon[i].id;
- nid.hIcon = pcli->trayIcon[i].hBaseIcon;
+ nid.uID = p.id;
+ nid.hIcon = p.hBaseIcon;
nid.uFlags = NIF_ICON | NIF_TIP;
// if Tipper is missing or turned off for tray, use system tooltips
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index f6983cb912..4a2d495b6d 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -169,27 +169,28 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s if (cli.trayIcon[i].id == 0)
break;
- cli.trayIcon[i].id = TRAYICON_ID_BASE + i;
- cli.trayIcon[i].szProto = (char*)szProto;
- cli.trayIcon[i].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, szIconProto ? szIconProto : cli.trayIcon[i].szProto, status);
+ trayIconInfo_t &p = cli.trayIcon[i];
+ p.id = TRAYICON_ID_BASE + i;
+ p.szProto = (char*)szProto;
+ p.hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, szIconProto ? szIconProto : p.szProto, status);
NOTIFYICONDATA nid = { SIZEOFNID };
nid.hWnd = hwnd;
- nid.uID = cli.trayIcon[i].id;
+ nid.uID = p.id;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = TIM_CALLBACK;
- nid.hIcon = cli.trayIcon[i].hBaseIcon;
+ nid.hIcon = p.hBaseIcon;
if (cli.shellVersion >= 5)
nid.uFlags |= NIF_INFO;
- cli.pfnTrayIconMakeTooltip(NULL, cli.trayIcon[i].szProto);
+ cli.pfnTrayIconMakeTooltip(NULL, p.szProto);
if (!hasTips())
mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
- cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ replaceStrT(p.ptszToolTip, cli.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
- cli.trayIcon[i].isBase = 1;
+ p.isBase = 1;
if (cli.trayIconCount == 1)
SetTaskBarIcon(cli.trayIcon[0].hBaseIcon, cli.szTip);
|