mirror of
https://github.com/nicbarker/clay.git
synced 2025-09-18 04:26:18 +00:00
Copy elementId in Clay__AddHashMapItem() in case underlying stringId has changed (#239)
This commit is contained in:
parent
a1e692b72a
commit
efad3deef8
1
clay.h
1
clay.h
|
@ -1199,6 +1199,7 @@ Clay_LayoutElementHashMapItem* Clay__AddHashMapItem(Clay_ElementId elementId, Cl
|
||||||
if (hashItem->elementId.id == elementId.id) { // Collision - resolve based on generation
|
if (hashItem->elementId.id == elementId.id) { // Collision - resolve based on generation
|
||||||
item.nextIndex = hashItem->nextIndex;
|
item.nextIndex = hashItem->nextIndex;
|
||||||
if (hashItem->generation <= context->generation) { // First collision - assume this is the "same" element
|
if (hashItem->generation <= context->generation) { // First collision - assume this is the "same" element
|
||||||
|
hashItem->elementId = elementId; // Make sure to copy this across. If the stringId reference has changed, we should update the hash item to use the new one.
|
||||||
hashItem->generation = context->generation + 1;
|
hashItem->generation = context->generation + 1;
|
||||||
hashItem->layoutElement = layoutElement;
|
hashItem->layoutElement = layoutElement;
|
||||||
hashItem->debugData->collision = false;
|
hashItem->debugData->collision = false;
|
||||||
|
|
Loading…
Reference in a new issue