update pGroup after realloc

This commit is contained in:
u130b8
2023-10-13 13:28:11 +03:00
parent 39229500f6
commit 59f7eb76bd

View File

@@ -266,9 +266,12 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi)
if (_msize(pGroup) != CalculateGroupMemory(pGroup, 1)) if (_msize(pGroup) != CalculateGroupMemory(pGroup, 1))
{ {
// if we reallocate memory then send the new pointer in // if we reallocate memory then send the new pointer in
if (realloc(pGroup, CalculateGroupMemory(pGroup, 1)) != NULL) PGROUP pNewGroup = realloc(pGroup, CalculateGroupMemory(pGroup, 1));
if (pNewGroup != NULL) {
pGroup = pNewGroup;
SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup); SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup);
} }
}
// add the item // add the item
pItem = &pGroup->pItemArray + pGroup->cItemArray; pItem = &pGroup->pItemArray + pGroup->cItemArray;