add menu for testing unresponsive interface

This commit is contained in:
ZappoMan 2018-02-22 17:34:00 -08:00
parent e9cad947d7
commit 9f68accb30
4 changed files with 15 additions and 0 deletions

View file

@ -7542,6 +7542,18 @@ void Application::deadlockApplication() {
}
}
// cause main thread to be unresponsive for 35 seconds
void Application::unresponsiveApplication() {
// to avoid compiler warnings about a loop that will never exit
uint64_t start = usecTimestampNow();
uint64_t UNRESPONSIVE_FOR_SECONDS = 35;
uint64_t UNRESPONSIVE_FOR_USECS = UNRESPONSIVE_FOR_SECONDS * USECS_PER_SECOND;
qCDebug(interfaceapp) << "Intentionally cause Interface to be unresponsive for " << UNRESPONSIVE_FOR_SECONDS << " seconds";
while (usecTimestampNow() - start < UNRESPONSIVE_FOR_USECS) {
QThread::sleep(1);
}
}
void Application::setActiveDisplayPlugin(const QString& pluginName) {
auto menu = Menu::getInstance();
foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {

View file

@ -367,6 +367,7 @@ public slots:
void updateHeartbeat() const;
static void deadlockApplication();
static void unresponsiveApplication(); // cause main thread to be unresponsive for 35 seconds
void rotationModeChanged() const;

View file

@ -713,6 +713,7 @@ Menu::Menu() {
MenuWrapper* crashMenu = developerMenu->addMenu("Crash");
addActionToQMenuAndActionHash(crashMenu, MenuOption::DeadlockInterface, 0, qApp, SLOT(deadlockApplication()));
addActionToQMenuAndActionHash(crashMenu, MenuOption::UnresponsiveInterface, 0, qApp, SLOT(unresponsiveApplication()));
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashPureVirtualFunction);
connect(action, &QAction::triggered, qApp, []() { crash::pureVirtualCall(); });

View file

@ -77,6 +77,7 @@ namespace MenuOption {
const QString CrashNewFault = "New Fault";
const QString CrashNewFaultThreaded = "New Fault (threaded)";
const QString DeadlockInterface = "Deadlock Interface";
const QString UnresponsiveInterface = "Unresponsive Interface";
const QString DecreaseAvatarSize = "Decrease Avatar Size";
const QString DefaultSkybox = "Default Skybox";
const QString DeleteAvatarBookmark = "Delete Avatar Bookmark...";