From efad3deef8f5b762562b83eb02642bcb665136a8 Mon Sep 17 00:00:00 2001 From: Harrison Lambeth Date: Wed, 29 Jan 2025 14:20:14 -0700 Subject: [PATCH] Copy elementId in Clay__AddHashMapItem() in case underlying stringId has changed (#239) --- clay.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clay.h b/clay.h index ff42f5c..e997dd2 100644 --- a/clay.h +++ b/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 item.nextIndex = hashItem->nextIndex; 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->layoutElement = layoutElement; hashItem->debugData->collision = false;