[0.4.12][INPUT] Don't race the system to free an imagelist

Fixes CORE-16121
"reproducible heap assertion at 2nd setup stage when
adding additional keyboard layouts"

https://reactos.org/testman/compare.php?ids=68231,68234

cherry-picked from 0.4.13-dev-459-g
f3d1d38041
This commit is contained in:
Mark Jansen 2019-06-16 21:54:44 +02:00 committed by Joachim Henze
parent ec3cc13ab0
commit e9fb7dcee2

View file

@ -226,7 +226,8 @@ OnInitSettingsPage(HWND hwndDlg)
ILC_COLOR8 | ILC_MASK, 0, 0);
if (hLayoutImageList != NULL)
{
ListView_SetImageList(hwndInputList, hLayoutImageList, LVSIL_SMALL);
HIMAGELIST hOldImagelist = ListView_SetImageList(hwndInputList, hLayoutImageList, LVSIL_SMALL);
ImageList_Destroy(hOldImagelist);
}
UpdateInputListView(hwndInputList);
@ -239,18 +240,9 @@ OnInitSettingsPage(HWND hwndDlg)
static VOID
OnDestroySettingsPage(HWND hwndDlg)
{
HIMAGELIST hImageList;
LayoutList_Destroy();
LocaleList_Destroy();
InputList_Destroy();
hImageList = ListView_GetImageList(GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST),
LVSIL_SMALL);
if (hImageList != NULL)
{
ImageList_Destroy(hImageList);
}
}