Author: gedmurphy
Date: Thu Aug 30 03:05:23 2007
New Revision: 28664
URL:
http://svn.reactos.org/svn/reactos?rev=28664&view=rev
Log:
release the image resource once it's assigned
Modified:
trunk/reactos/base/applications/mscutils/servman/listview.c
Modified: trunk/reactos/base/applications/mscutils/servman/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/listview.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/listview.c Thu Aug 30 03:05:23 2007
@@ -122,7 +122,6 @@
lpServiceConfig);
}
}
-
break;
case LVDESC:
@@ -370,51 +369,57 @@
static VOID
InitListViewImage(PMAIN_WND_INFO Info)
{
- HICON hSmIconItem, hLgIconItem; /* icon for list-view items */
- HIMAGELIST hSmall, hLarge; /* image list for other views */
-
-
- /* Create the icon image lists */
+ HICON hSmIconItem, hLgIconItem;
+ HIMAGELIST hSmall, hLarge;
+
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
ILC_MASK | ILC_COLOR32,
1,
1);
+ if (hSmall)
+ {
+ hSmIconItem = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDI_SM_ICON),
+ IMAGE_ICON,
+ 16,
+ 16,
+ 0);
+ if (hSmIconItem)
+ {
+ ImageList_AddIcon(hSmall,
+ hSmIconItem);
+ (void)ListView_SetImageList(Info->hListView,
+ hSmall,
+ LVSIL_SMALL);
+
+ DestroyIcon(hSmIconItem);
+ }
+ }
hLarge = ImageList_Create(GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
ILC_MASK | ILC_COLOR32,
1,
1);
-
- /* Add an icon to each image list */
- hSmIconItem = LoadImage(hInstance,
- MAKEINTRESOURCE(IDI_SM_ICON),
- IMAGE_ICON,
- 16,
- 16,
- 0);
-
- ImageList_AddIcon(hSmall,
- hSmIconItem);
-
- hLgIconItem = LoadImage(hInstance,
- MAKEINTRESOURCE(IDI_SM_ICON),
- IMAGE_ICON,
- 32,
- 32,
- 0);
-
- ImageList_AddIcon(hLarge,
- hLgIconItem);
-
- /* assign the image to the list view */
- (void)ListView_SetImageList(Info->hListView,
- hSmall,
- LVSIL_SMALL);
- (void)ListView_SetImageList(Info->hListView,
- hLarge,
- LVSIL_NORMAL);
+ if (hLarge)
+ {
+ hLgIconItem = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDI_SM_ICON),
+ IMAGE_ICON,
+ 32,
+ 32,
+ 0);
+ if (hLgIconItem)
+ {
+ ImageList_AddIcon(hLarge,
+ hLgIconItem);
+ (void)ListView_SetImageList(Info->hListView,
+ hLarge,
+ LVSIL_NORMAL);
+ DestroyIcon(hLgIconItem);
+ }
+ }
}