mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +02:00
Fix the crash
This commit is contained in:
parent
c570d483d8
commit
07a4beac73
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