comparison win/dw.c @ 1508:9b2600034473

Safety check in _lookup_icon() on Windows to make sure we don't try to add an invalid icon handle to the image list.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 27 Dec 2011 10:47:38 +0000
parents 97002721c4ca
children 50d972da558e
comparison
equal deleted inserted replaced
1507:fbe9028af341 1508:9b2600034473
8303 int _lookup_icon(HWND handle, HICON hicon, int type) 8303 int _lookup_icon(HWND handle, HICON hicon, int type)
8304 { 8304 {
8305 int z; 8305 int z;
8306 static HWND lasthwnd = NULL; 8306 static HWND lasthwnd = NULL;
8307 8307
8308 /* We can't add an invalid handle */
8309 if(!hicon)
8310 return -1;
8311
8308 if(!hSmall || !hLarge) 8312 if(!hSmall || !hLarge)
8309 { 8313 {
8310 hSmall = ImageList_Create(16, 16, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0); 8314 hSmall = ImageList_Create(16, 16, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0);
8311 hLarge = ImageList_Create(32, 32, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0); 8315 hLarge = ImageList_Create(32, 32, ILC_COLOR16 | ILC_MASK, ICON_INDEX_LIMIT, 0);
8312 } 8316 }