mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +02:00
Merge pull request #11130 from zfox23/contextOverlays_fixCrash1
Fix crash in Context Overlays code
This commit is contained in:
commit
36453644e0
1 changed files with 16 additions and 8 deletions
|
@ -257,15 +257,23 @@ void ContextOverlayInterface::openMarketplace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextOverlayInterface::enableEntityHighlight(const EntityItemID& entityItemID) {
|
void ContextOverlayInterface::enableEntityHighlight(const EntityItemID& entityItemID) {
|
||||||
if (!qApp->getEntities()->getTree()->findEntityByEntityItemID(entityItemID)->getShouldHighlight()) {
|
auto entityTree = qApp->getEntities()->getTree();
|
||||||
qCDebug(context_overlay) << "Setting 'shouldHighlight' to 'true' for Entity ID:" << entityItemID;
|
entityTree->withReadLock([&] {
|
||||||
qApp->getEntities()->getTree()->findEntityByEntityItemID(entityItemID)->setShouldHighlight(true);
|
auto entityItem = entityTree->findEntityByEntityItemID(entityItemID);
|
||||||
}
|
if ((entityItem != NULL) && !entityItem->getShouldHighlight()) {
|
||||||
|
qCDebug(context_overlay) << "Setting 'shouldHighlight' to 'true' for Entity ID:" << entityItemID;
|
||||||
|
entityItem->setShouldHighlight(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextOverlayInterface::disableEntityHighlight(const EntityItemID& entityItemID) {
|
void ContextOverlayInterface::disableEntityHighlight(const EntityItemID& entityItemID) {
|
||||||
if (qApp->getEntities()->getTree()->findEntityByEntityItemID(entityItemID)->getShouldHighlight()) {
|
auto entityTree = qApp->getEntities()->getTree();
|
||||||
qCDebug(context_overlay) << "Setting 'shouldHighlight' to 'false' for Entity ID:" << entityItemID;
|
entityTree->withReadLock([&] {
|
||||||
qApp->getEntities()->getTree()->findEntityByEntityItemID(entityItemID)->setShouldHighlight(false);
|
auto entityItem = entityTree->findEntityByEntityItemID(entityItemID);
|
||||||
}
|
if ((entityItem != NULL) && entityItem->getShouldHighlight()) {
|
||||||
|
qCDebug(context_overlay) << "Setting 'shouldHighlight' to 'false' for Entity ID:" << entityItemID;
|
||||||
|
entityItem->setShouldHighlight(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue