From 631e566f0728b637664f2a42a6d4031f8d5ac5dd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Jan 2014 15:59:54 +0000 Subject: patch not to destroy managed status line icons git-svn-id: http://svn.miranda-ng.org/main/trunk@7441 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/srmm/statusicon.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index 08107d9cc6..2b88911990 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-14 Miranda NG project, +Copyright (c) 2012-14 Miranda NG project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -27,10 +27,8 @@ struct StatusIconChild : public MZeroedObject { ~StatusIconChild() { - if (hIcon) - DestroyIcon(hIcon); - if (hIconDisabled) - DestroyIcon(hIconDisabled); + SafeDestroyIcon(hIcon); + SafeDestroyIcon(hIconDisabled); mir_free(tszTooltip); } @@ -38,6 +36,15 @@ struct StatusIconChild : public MZeroedObject HICON hIcon, hIconDisabled; int flags; TCHAR *tszTooltip; + + void SafeDestroyIcon(HICON hIcon) + { + if (hIcon == NULL) + return; + + if (!IcoLib_IsManaged(hIcon)) + ::DestroyIcon(hIcon); + } }; struct StatusIconMain : public MZeroedObject @@ -99,10 +106,7 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) pc->hContact = hContact; p->arChildren.insert(pc); } - else { - if (pc->hIcon) - DestroyIcon(pc->hIcon); - } + else pc->SafeDestroyIcon(pc->hIcon); pc->flags = sid->flags; pc->hIcon = sid->hIcon; -- cgit v1.2.3