Skip to content

Commit

Permalink
#6158: Fix crash due to race condition in EntityPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 12, 2022
1 parent 398e3be commit f2fc508
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libs/wxutil/preview/EntityPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ void EntityPreview::setEntity(const IEntityNodePtr& entity)

if (_entity)
{
_rootNode->removeChildNode(_entity);
// Use getScene to access the root node to ensure it's created
getScene()->root()->removeChildNode(_entity);
}

_entity = entity;

if (_entity)
{
_rootNode->addChildNode(_entity);
getScene()->root()->addChildNode(_entity);

// Remember the entity bounds including children
_untransformedEntityBounds = _entity->worldAABB();
Expand Down

0 comments on commit f2fc508

Please sign in to comment.