Merge pull request #7956 from jherico/web_entity_crash

fix crash on click on non-visible web-entity
This commit is contained in:
Brad Hefta-Gaub 2016-06-03 10:29:55 -07:00
commit c85923c69b
2 changed files with 14 additions and 2 deletions

View file

@ -994,7 +994,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
if (_keyboardFocusedItem != entityItemID) {
_keyboardFocusedItem = UNKNOWN_ENTITY_ID;
auto properties = entityScriptingInterface->getEntityProperties(entityItemID);
if (EntityTypes::Web == properties.getType() && !properties.getLocked()) {
if (EntityTypes::Web == properties.getType() && !properties.getLocked() && properties.getVisible()) {
auto entity = entityScriptingInterface->getEntityTree()->findEntityByID(entityItemID);
RenderableWebEntityItem* webEntity = dynamic_cast<RenderableWebEntityItem*>(entity.get());
if (webEntity) {
@ -1049,6 +1049,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
}
});
connect(this, &Application::aboutToQuit, [=]() {
_keyboardFocusedItem = UNKNOWN_ENTITY_ID;
if (_keyboardFocusHighlight) {
_keyboardFocusHighlight->setVisible(false);
}
});
// Make sure we don't time out during slow operations at startup
updateHeartbeat();

View file

@ -226,10 +226,15 @@ void RenderableWebEntityItem::setSourceUrl(const QString& value) {
}
void RenderableWebEntityItem::setProxyWindow(QWindow* proxyWindow) {
_webSurface->setProxyWindow(proxyWindow);
if (_webSurface) {
_webSurface->setProxyWindow(proxyWindow);
}
}
QObject* RenderableWebEntityItem::getEventHandler() {
if (!_webSurface) {
return nullptr;
}
return _webSurface->getEventHandler();
}