Module: wine Branch: master Commit: a061d3a0d4e5e81af6236225486e12b1779c1f58 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a061d3a0d4e5e81af623622548...
Author: Nikolay Sivov bunglehead@gmail.com Date: Thu Oct 22 04:56:47 2009 +0400
comctl32: Fix imagelist leak when switching LVS_EX_CHECKBOXES style.
---
dlls/comctl32/listview.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index a97fc46..952c589 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -7932,10 +7932,18 @@ static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD dwM LISTVIEW_SetItemState(infoPtr, -1, &item);
himl = LISTVIEW_CreateCheckBoxIL(infoPtr); + if(!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) + ImageList_Destroy(infoPtr->himlState); } - LISTVIEW_SetImageList(infoPtr, LVSIL_STATE, himl); + himl = LISTVIEW_SetImageList(infoPtr, LVSIL_STATE, himl); + /* checkbox list replaces prevous custom list or... */ + if(((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) && + !(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) || + /* ...previous was checkbox list */ + (dwOldExStyle & LVS_EX_CHECKBOXES)) + ImageList_Destroy(himl); } - + if((infoPtr->dwLvExStyle ^ dwOldExStyle) & LVS_EX_HEADERDRAGDROP) { DWORD dwStyle; @@ -9664,12 +9672,9 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr) /* destroy image lists */ if (!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) { - if (infoPtr->himlNormal) - ImageList_Destroy(infoPtr->himlNormal); - if (infoPtr->himlSmall) - ImageList_Destroy(infoPtr->himlSmall); - if (infoPtr->himlState) - ImageList_Destroy(infoPtr->himlState); + ImageList_Destroy(infoPtr->himlNormal); + ImageList_Destroy(infoPtr->himlSmall); + ImageList_Destroy(infoPtr->himlState); }
/* destroy font, bkgnd brush */