Skip to content

Commit f2fc508

Browse files
committed
#6158: Fix crash due to race condition in EntityPreview
1 parent 398e3be commit f2fc508

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libs/wxutil/preview/EntityPreview.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ void EntityPreview::setEntity(const IEntityNodePtr& entity)
3333

3434
if (_entity)
3535
{
36-
_rootNode->removeChildNode(_entity);
36+
// Use getScene to access the root node to ensure it's created
37+
getScene()->root()->removeChildNode(_entity);
3738
}
3839

3940
_entity = entity;
4041

4142
if (_entity)
4243
{
43-
_rootNode->addChildNode(_entity);
44+
getScene()->root()->addChildNode(_entity);
4445

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

0 commit comments

Comments
 (0)