Skip to content

Commit

Permalink
20987: Fixes deadlock when calling (clone_entities (null) (null)) (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
howsohazard authored Jul 22, 2024
1 parent f420547 commit 157e5ce
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Amalgam/interpreter/InterpreterOpcodesEntityControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ EvaluableNodeReference Interpreter::InterpretNode_ENT_CLONE_ENTITIES(EvaluableNo
continue;
}

//create new entity
Entity *new_entity = new Entity(source_entity);

//clear previous lock
source_entity = EntityReadReference();

//get destination if applicable
EntityWriteReference destination_entity_parent;
StringInternRef new_entity_id;
Expand All @@ -424,16 +430,11 @@ EvaluableNodeReference Interpreter::InterpretNode_ENT_CLONE_ENTITIES(EvaluableNo

if(destination_entity_parent == nullptr)
{
delete new_entity;
new_entity_ids_list->AppendOrderedChildNode(nullptr);
continue;
}

//create new entity
Entity *new_entity = new Entity(source_entity);

//clear previous lock
source_entity = EntityReadReference();

//accumulate usage
if(ConstrainedAllocatedNodes())
performanceConstraints->curNumAllocatedNodesAllocatedToEntities += new_entity->GetDeepSizeInNodes();
Expand Down

0 comments on commit 157e5ce

Please sign in to comment.