Merge pull request #6791 from jherico/qml_hang

Stop QML hanging the app on shutdown
This commit is contained in:
Philip Rosedale 2016-01-07 13:29:47 -08:00
commit c5ab29071e
2 changed files with 5 additions and 3 deletions

View file

@ -696,7 +696,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
auto userInputMapper = DependencyManager::get<UserInputMapper>(); auto userInputMapper = DependencyManager::get<UserInputMapper>();
connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) { connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) {
using namespace controller; using namespace controller;
static auto offscreenUi = DependencyManager::get<OffscreenUi>(); auto offscreenUi = DependencyManager::get<OffscreenUi>();
if (offscreenUi->navigationFocused()) { if (offscreenUi->navigationFocused()) {
auto actionEnum = static_cast<Action>(action); auto actionEnum = static_cast<Action>(action);
int key = Qt::Key_unknown; int key = Qt::Key_unknown;
@ -836,7 +836,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
return (float)qApp->getMyAvatar()->getCharacterController()->onGround(); return (float)qApp->getMyAvatar()->getCharacterController()->onGround();
})); }));
_applicationStateDevice->addInputVariant(QString("NavigationFocused"), controller::StateController::ReadLambda([]() -> float { _applicationStateDevice->addInputVariant(QString("NavigationFocused"), controller::StateController::ReadLambda([]() -> float {
static auto offscreenUi = DependencyManager::get<OffscreenUi>(); auto offscreenUi = DependencyManager::get<OffscreenUi>();
return offscreenUi->navigationFocused() ? 1.0 : 0.0; return offscreenUi->navigationFocused() ? 1.0 : 0.0;
})); }));
@ -1051,6 +1051,8 @@ void Application::cleanupBeforeQuit() {
#ifdef HAVE_IVIEWHMD #ifdef HAVE_IVIEWHMD
DependencyManager::destroy<EyeTracker>(); DependencyManager::destroy<EyeTracker>();
#endif #endif
DependencyManager::destroy<OffscreenUi>();
} }
void Application::emptyLocalCache() { void Application::emptyLocalCache() {

View file

@ -254,7 +254,7 @@ private:
_quit = true; _quit = true;
} }
static const uint64_t MAX_SHUTDOWN_WAIT_SECS = 5; static const uint64_t MAX_SHUTDOWN_WAIT_SECS = 2;
void stop() { void stop() {
if (_thread.isRunning()) { if (_thread.isRunning()) {
qDebug() << "Stopping QML render thread " << _thread.currentThreadId(); qDebug() << "Stopping QML render thread " << _thread.currentThreadId();