From 3335c040e50018f2cf0732dc2015731a3e2a19b5 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Mon, 18 Jan 2021 18:39:12 -0800 Subject: [PATCH] hurr durr I'm an idiot --- .../ui/src/ui/TabletScriptingInterface.cpp | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index c09888758c..61c74dc17c 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -321,8 +321,8 @@ void TabletScriptingInterface::processEvent(const QKeyEvent* event) { QObject* TabletScriptingInterface::getFlags() { Q_ASSERT(QThread::currentThread() == qApp->thread()); - auto offscreenUi = DependencyManager::get(); - return offscreenUi->getFlags(); + auto offscreenUI = DependencyManager::get(); + return offscreenUI ? offscreenUI->getFlags() : nullptr; } // @@ -364,8 +364,6 @@ void TabletProxy::setToolbarMode(bool toolbarMode) { _toolbarMode = toolbarMode; - auto offscreenUi = DependencyManager::get(); - if (toolbarMode) { #if !defined(DISABLE_QML) closeDialog(); @@ -385,18 +383,21 @@ void TabletProxy::setToolbarMode(bool toolbarMode) { connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml); #endif } else { -#if !defined(DISABLE_QML) if (_currentPathLoaded != TABLET_HOME_SOURCE_URL) { loadHomeScreen(true); } -#endif - //check if running scripts window opened and save it for reopen in Tablet - if (offscreenUi->isVisible("RunningScripts")) { - offscreenUi->hide("RunningScripts"); - _showRunningScripts = true; + + auto offscreenUI = DependencyManager::get(); + if (offscreenUI) { + //check if running scripts window opened and save it for reopen in Tablet + if (offscreenUI->isVisible("RunningScripts")) { + offscreenUI->hide("RunningScripts"); + _showRunningScripts = true; + } + + offscreenUI->hideDesktopWindows(); } - offscreenUi->hideDesktopWindows(); // destroy desktop window if (_desktopWindow) { _desktopWindow->deleteLater(); @@ -579,9 +580,9 @@ void TabletProxy::gotoMenuScreen(const QString& submenu) { root = _desktopWindow->asQuickItem(); } - if (root) { - auto offscreenUi = DependencyManager::get(); - QObject* menu = offscreenUi->getRootMenu(); + auto offscreenUI = DependencyManager::get(); + if (root && offscreenUI) { + QObject* menu = offscreenUI->getRootMenu(); QMetaObject::invokeMethod(root, "setMenuProperties", Q_ARG(QVariant, QVariant::fromValue(menu)), Q_ARG(const QVariant&, QVariant(submenu))); QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL))); _state = State::Menu;